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 2016/01/25 19:01:17 UTC
[01/51] celix git commit: CELIX-77: Update config_admin implementation
Repository: celix
Updated Branches:
refs/heads/feature/CELIX-335_deploy_refactoring cd1f7491f -> a43d78b30
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c b/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c
deleted file mode 100644
index 2812637..0000000
--- a/config_admin/examples/example_test2/bundle_managed_service/private/src/example_managed_service_impl.c
+++ /dev/null
@@ -1,95 +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.
- */
-/*
- * example_managed_service_impl.c
- *
- * \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "example_managed_service_impl.h"
-
-/* ------------------------ Constructor -------------------------------------*/
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance){
-
- celix_status_t status = CELIX_SUCCESS;
-
-
- managed_service_pt managedService = calloc(1, sizeof(*managedService));
- if(!managedService){
- printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
- return CELIX_ENOMEM;
- }
-
- managedService->context = context;
- managedService->registration = NULL;
- managedService->properties = NULL;
-
- printf("[ ManagedServiceImpl ]: ManagedServiceImpl - Initialized \n");
- *instance = managedService;
- return status;
-}
-
-
-/* -------------------- Implementation --------------------------------------*/
-
-celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt properties){
-
- if (properties == NULL){
- printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
- managedService->properties = NULL;
- }else{
- printf("[ managedServiceImpl ]: updated - Received New Properties \n");
- managedService->properties = properties_create();
- managedService->properties = properties;
- }
-
- return CELIX_SUCCESS;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/readme.md
----------------------------------------------------------------------
diff --git a/config_admin/readme.md b/config_admin/readme.md
new file mode 100644
index 0000000..900d8a7
--- /dev/null
+++ b/config_admin/readme.md
@@ -0,0 +1,29 @@
+# Configuration Admin
+
+---
+
+## Introduction
+The configuration Admin service allows defining and deploying configuration data to bundles.
+When compared to config.properties it adds the option to update configuration data by providing a persisten storage. It also allows changing configuration data at run-time.
+
+---
+
+## Design
+
+The config_admin bundle implements the configuration_admin service, the interface to configuration objects and the interface of a managed service. At the moment, the implementation uses a config_admin_factory to generate config_admin services for each bundle that wants to use this service. This is an inheritance of the original design and not needed.
+
+---
+
+## TODO
+
+1. Test the configuration of a service_factory
+2. Think about the option to allow remote update of the managed_services
+
+---
+
+## Usage
+
+1. Bundle that needs configuration data
+ This bundle has to register next to its normal service a managed service that has an update method. Use config_admin_tst/example_test as an example (it is better than example_test2)
+2. Bundle/application that wants to update the configuration data of the system
+ This bundle needs to retrieve the running config_admin service. With this service it can retrieve all configuration objects for all known Persistent Identifiers (PIDs). For each PID, get all properites that need to be updated. See config_admin_test for an example.
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/include/configuration_admin_factory.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_admin_factory.h b/config_admin/service/private/include/configuration_admin_factory.h
index 0afed60..d86ea78 100644
--- a/config_admin/service/private/include/configuration_admin_factory.h
+++ b/config_admin/service/private/include/configuration_admin_factory.h
@@ -47,7 +47,7 @@ typedef struct configuration_admin_factory *configuration_admin_factory_pt;
/* METHODS */
celix_status_t configurationAdminFactory_create(bundle_context_pt context, service_factory_pt *factory, configuration_admin_factory_pt *instance);
-
+celix_status_t configurationAdminFactory_destroy( bundle_context_pt context, configuration_admin_factory_pt instance);
celix_status_t configurationAdminFactory_start(configuration_admin_factory_pt factory);
celix_status_t configurationAdminFactory_stop(configuration_admin_factory_pt factory);
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/include/configuration_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_impl.h b/config_admin/service/private/include/configuration_impl.h
index 05b9c91..71a488c 100644
--- a/config_admin/service/private/include/configuration_impl.h
+++ b/config_admin/service/private/include/configuration_impl.h
@@ -37,30 +37,36 @@
#include "configuration_admin_factory.h"
#include "configuration_store.h"
+typedef struct configuration_impl *configuration_impl_pt;
+//typedef struct configuration_impl *configuration_pt;
+
+#if 0
+
-celix_status_t configuration_create( configuration_admin_factory_pt factory, configuration_store_pt store,
- char *factoryPid, char *pid, char *bundleLocation,
- configuration_pt *configuration);
-celix_status_t configuration_create2(configuration_admin_factory_pt factory, configuration_store_pt store,
- properties_pt dictionary,
- configuration_pt *configuration);
-celix_status_t configuration_lock(configuration_pt configuration);
-celix_status_t configuration_unlock(configuration_pt configuration);
-celix_status_t configuration_checkLocked(configuration_pt configuration);
-celix_status_t configuration_bind(configuration_pt configuration, bundle_pt bundle, bool *isBind);
-celix_status_t configuration_unbind(configuration_pt configuration, bundle_pt bundle);
-celix_status_t configuration_checkDeleted(configuration_pt configuration);
-celix_status_t configuration_getBundleLocation2(configuration_pt configuration, bool checkPermission, char **location);
celix_status_t configuration_getFactoryPid2(configuration_pt configuration, bool checkDeleted, char **factoryPid);
celix_status_t configuration_getPid2(configuration_pt configuration, bool checkDeleted, char **pid);
-celix_status_t configuration_getAllProperties(configuration_pt configuration, properties_pt *properties);
celix_status_t configuration_isDeleted(configuration_pt configuration, bool *isDeleted);
+#endif
+celix_status_t configuration_lock(configuration_impl_pt configuration);
+celix_status_t configuration_unlock(configuration_impl_pt configuration);
+celix_status_t configuration_create( configuration_admin_factory_pt factory, configuration_store_pt store,
+ char *factoryPid, char *pid, char *bundleLocation,
+ configuration_pt *configuration);
+celix_status_t configuration_create2(configuration_admin_factory_pt factory, configuration_store_pt store,
+ properties_pt dictionary,
+ configuration_pt *configuration);
+celix_status_t configuration_getBundleLocation2(configuration_impl_pt configuration, bool checkPermission, char **location);
+celix_status_t configuration_bind(configuration_impl_pt configuration, bundle_pt bundle, bool *isBind);
+celix_status_t configuration_unbind(configuration_impl_pt configuration, bundle_pt bundle);
+celix_status_t configuration_checkLocked(configuration_impl_pt configuration);
+celix_status_t configuration_getAllProperties(configuration_impl_pt configuration, properties_pt *properties);
-
+celix_status_t configuration_getPid(void *handle, char **pid);
+celix_status_t configuration_getProperties(void *handle, properties_pt *properties);
#endif /* CONFIGURATION_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/include/configuration_store.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_store.h b/config_admin/service/private/include/configuration_store.h
index afdb985..e5f9a8c 100644
--- a/config_admin/service/private/include/configuration_store.h
+++ b/config_admin/service/private/include/configuration_store.h
@@ -43,6 +43,7 @@ typedef struct configuration_store *configuration_store_pt;
/* METHODS */
celix_status_t configurationStore_create(bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt *store);
+celix_status_t configurationStore_destroy(configuration_store_pt store);
celix_status_t configurationStore_lock(configuration_store_pt store);
celix_status_t configurationStore_unlock(configuration_store_pt store);
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/include/managed_service_tracker.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/managed_service_tracker.h b/config_admin/service/private/include/managed_service_tracker.h
index 774f4a2..c29ea6a 100644
--- a/config_admin/service/private/include/managed_service_tracker.h
+++ b/config_admin/service/private/include/managed_service_tracker.h
@@ -40,15 +40,16 @@
#include "configuration_store.h"
-typedef struct managed_service_tracker *managed_service_tracker_t;
+typedef struct managed_service_tracker *managed_service_tracker_pt;
celix_status_t managedServiceTracker_create(bundle_context_pt context,
configuration_admin_factory_pt factory, configuration_store_pt store,
- managed_service_tracker_t *trackerHandle, service_tracker_pt *tracker);
+ managed_service_tracker_pt *trackerHandle, service_tracker_pt *tracker);
+celix_status_t managedServiceTracker_destroy(bundle_context_pt context, managed_service_tracker_pt handle, service_tracker_pt tracker);
-celix_status_t managedServiceTracker_notifyDeleted(managed_service_tracker_t tracker, configuration_pt configuration);
-celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tracker, configuration_pt configuration);
+celix_status_t managedServiceTracker_notifyDeleted(managed_service_tracker_pt tracker, configuration_pt configuration);
+celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_pt tracker, configuration_pt configuration);
celix_status_t managedServiceTracker_addingService(void * handle, service_reference_pt reference, void **service);
celix_status_t managedServiceTracker_addedService(void * handle, service_reference_pt reference, void * service);
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/include/updated_thread_pool.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/updated_thread_pool.h b/config_admin/service/private/include/updated_thread_pool.h
index 3b51db3..3dac3a2 100644
--- a/config_admin/service/private/include/updated_thread_pool.h
+++ b/config_admin/service/private/include/updated_thread_pool.h
@@ -33,7 +33,7 @@
#define MAX_THREADS 10
-typedef struct updated_thread_pool *updated_thread_pool_t;
+typedef struct updated_thread_pool *updated_thread_pool_pt;
/* celix.framework.public */
#include "bundle_context.h"
@@ -44,9 +44,9 @@ typedef struct updated_thread_pool *updated_thread_pool_t;
-celix_status_t updatedThreadPool_create( bundle_context_pt context, int maxTreads, updated_thread_pool_t *updatedThreadPool);
-
-celix_status_t updatedThreadPool_push(updated_thread_pool_t updatedThreadPool, managed_service_service_pt service, properties_pt properties);
+celix_status_t updatedThreadPool_create( bundle_context_pt context, int maxTreads, updated_thread_pool_pt *updatedThreadPool);
+celix_status_t updatedThreadPool_destroy(updated_thread_pool_pt pool);
+celix_status_t updatedThreadPool_push(updated_thread_pool_pt updatedThreadPool, managed_service_service_pt service, properties_pt properties);
#endif /* UPDATED_THREAD_POOL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/activator.c b/config_admin/service/private/src/activator.c
index 8818051..0cc432c 100644
--- a/config_admin/service/private/src/activator.c
+++ b/config_admin/service/private/src/activator.c
@@ -44,6 +44,7 @@
struct config_admin_bundle {
bundle_context_pt context;
service_registration_pt configAdminFactoryReg;
+ configuration_admin_factory_pt configAdminFactoryInstance;
};
typedef struct config_admin_bundle *config_admin_bundle_t;
@@ -66,6 +67,7 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
(*userData) = bi;
bi->context = context;
bi->configAdminFactoryReg = NULL;
+ bi->configAdminFactoryInstance = NULL;
status = CELIX_SUCCESS;
@@ -80,9 +82,8 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
config_admin_bundle_t bi = (config_admin_bundle_t) userData;
service_factory_pt configAdminFactory;
- configuration_admin_factory_pt configAdminFactoryInstance;
- status = configurationAdminFactory_create(bi->context, &configAdminFactory, &configAdminFactoryInstance);
+ status = configurationAdminFactory_create(bi->context, &configAdminFactory, &bi->configAdminFactoryInstance);
if (status != CELIX_SUCCESS){
return status;
}
@@ -93,7 +94,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
}
printf("[ SUCCESS ]: Activator - ConfigAdminFactory Registered \n");
- status = configurationAdminFactory_start(configAdminFactoryInstance);
+ status = configurationAdminFactory_start(bi->configAdminFactoryInstance);
if (status != CELIX_SUCCESS){
return status;
}
@@ -107,8 +108,9 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
celix_status_t status = CELIX_SUCCESS;
config_admin_bundle_t bi = (config_admin_bundle_t) userData;
-
+ configurationAdminFactory_stop(bi->configAdminFactoryInstance);
serviceRegistration_unregister(bi->configAdminFactoryReg);
+ configurationAdminFactory_destroy(context, bi->configAdminFactoryInstance);
bi->configAdminFactoryReg = NULL;
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/configuration_admin_factory.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_factory.c b/config_admin/service/private/src/configuration_admin_factory.c
index d2eced5..9377ba5 100644
--- a/config_admin/service/private/src/configuration_admin_factory.c
+++ b/config_admin/service/private/src/configuration_admin_factory.c
@@ -48,7 +48,7 @@ struct configuration_admin_factory{
// configuration_permission_t configurationPermission;
// event_dispatcher_t eventDispatcher;
// plugin_manager_t pluginManager;
- managed_service_tracker_t managedServiceTrackerHandle;
+ managed_service_tracker_pt managedServiceTrackerHandle;
service_tracker_pt managedServiceTracker;
// managed_service_factory_ptracker_t managedServiceFactoryTracker;
configuration_store_pt configurationStore;
@@ -70,7 +70,7 @@ celix_status_t configurationAdminFactory_create( bundle_context_pt context, serv
configuration_admin_factory_pt this = calloc(1, sizeof(*this));
configuration_store_pt configurationStore;
- managed_service_tracker_t managedServiceTrackerHandle;
+ managed_service_tracker_pt managedServiceTrackerHandle;
service_tracker_pt managedServiceTracker;
// (1) SERVICE FACTORY
@@ -104,12 +104,17 @@ celix_status_t configurationAdminFactory_create( bundle_context_pt context, serv
(*factory)->getService = configurationAdminFactory_getService;
(*factory)->ungetService = configurationAdminFactory_ungetService;
- printf("[ SUCCESS ]: ConfigAdminFactory - Initialized \n");
*instance = this;
return CELIX_SUCCESS;
}
+celix_status_t configurationAdminFactory_destroy( bundle_context_pt context, configuration_admin_factory_pt instance){
+ managedServiceTracker_destroy(context, instance->managedServiceTrackerHandle, instance->managedServiceTracker);
+ configurationStore_destroy(instance->configurationStore);
+ free(instance);
+ return CELIX_SUCCESS;
+}
/* ========== IMPLEMENTS SERVICE FACTORY ========== */
/* ---------- public ---------- */
@@ -118,7 +123,7 @@ celix_status_t configurationAdminFactory_getService(void *factory, bundle_pt bun
celix_status_t status;
- configuration_admin_factory_pt configAdminFactory = ((service_factory_pt) factory)->factory;
+ configuration_admin_factory_pt configAdminFactory = (configuration_admin_factory_pt) factory;
configuration_admin_service_pt confAdminService;
// TODO
@@ -131,11 +136,11 @@ celix_status_t configurationAdminFactory_getService(void *factory, bundle_pt bun
return status;
}
- /* DEBUG CODE */
+ /* DEBUG CODE *
char* location;
bundle_getBundleLocation(bundle, &location);
printf("[ SUCCESS ]: ConfigAdminFactory - get configAdminService (bundle=%s) \n ",location);
- /* END DEBUG CODE */
+ * END DEBUG CODE */
(*service) = confAdminService;
return CELIX_SUCCESS;
@@ -155,19 +160,19 @@ celix_status_t configurationAdminFactory_ungetService(void *factory, bundle_pt b
celix_status_t configurationAdminFactory_start(configuration_admin_factory_pt factory){
celix_status_t status;
-
+ printf("%s\n", __func__);
status = serviceTracker_open(factory->managedServiceTracker);
if( status!=CELIX_SUCCESS ){
printf("[ ERROR ]: ConfigAdminFactory - ManagedServiceTracker not opened \n");
return status;
}
- printf("[ SUCCESS ]: ConfigAdminFactory - ManagedServiceTracker opened \n");
return CELIX_SUCCESS;
}
celix_status_t configurationAdminFactory_stop(configuration_admin_factory_pt factory){
- return CELIX_SUCCESS;
+ celix_status_t status = serviceTracker_close(factory->managedServiceTracker);
+ return status;;
}
celix_status_t configurationAdminFactory_checkConfigurationPermission(configuration_admin_factory_pt factory){
@@ -182,12 +187,10 @@ celix_status_t configurationAdminFactory_notifyConfigurationUpdated(configuratio
if (isFactory == true){
- printf("[ DEBUG ]: ConfigAdminFactory - notifyConfigUpdated Factory \n");
return CELIX_SUCCESS;
}else{
- printf("[ DEBUG ]: ConfigAdminFactory - notifyConfigUpdated \n");
return managedServiceTracker_notifyUpdated(factory->managedServiceTrackerHandle,configuration);
}
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/configuration_admin_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_impl.c b/config_admin/service/private/src/configuration_admin_impl.c
index 5edaba1..5bda485 100644
--- a/config_admin/service/private/src/configuration_admin_impl.c
+++ b/config_admin/service/private/src/configuration_admin_impl.c
@@ -72,13 +72,17 @@ celix_status_t configurationAdmin_create(configuration_admin_factory_pt factory,
(*service)->getConfiguration2 = configurationAdmin_getConfiguration2;
(*service)->listConfigurations = configurationAdmin_listConfigurations;
- printf("[ SUCCESS ]: ConfigAdmin - Initialized \n");
return CELIX_SUCCESS;
}
+celix_status_t configurationAdmin_destroy(configuration_admin_service_pt *service) {
+ free(service);
+ return CELIX_SUCCESS;
+}
/* ========== IMPLEMENTATION ========== */
+
/* ---------- public ---------- */
celix_status_t configurationAdmin_createFactoryConfiguration(configuration_admin_pt configAdmin, char *factoryPid, configuration_pt *configuration){
@@ -114,8 +118,6 @@ celix_status_t configurationAdmin_getConfiguration(configuration_admin_pt config
return CELIX_ILLEGAL_ARGUMENT;
}
- printf("[ DEBUG ]: ConfigAdmin - getBundleLocation \n");
-
/* ---------- pseudo code ---------- */
/*
@@ -132,7 +134,7 @@ celix_status_t configurationAdmin_getConfiguration(configuration_admin_pt config
// (4) config.getBundleLocation != NULL ?
- if ( configuration_getBundleLocation2(config,false,&configBundleLocation) == CELIX_SUCCESS ){
+ if ( configuration_getBundleLocation2(config->handle,false,&configBundleLocation) == CELIX_SUCCESS ){
if ( strcmp(configAdminBundleLocation,configBundleLocation) != 0 ){
@@ -146,13 +148,12 @@ celix_status_t configurationAdmin_getConfiguration(configuration_admin_pt config
// (5) config.bind(bundle)
bool dummy;
- if ( configuration_bind(config, configAdmin->bundle, &dummy) != CELIX_SUCCESS){
+ if ( configuration_bind(config->handle, configAdmin->bundle, &dummy) != CELIX_SUCCESS){
*configuration = NULL;
printf("[ ERROR]: ConfigAdmin - bind Config.");
return CELIX_ILLEGAL_STATE;
}
- printf("[ SUCCESS ]: ConfigAdmin - get Configuration \n");
*configuration = config;
return CELIX_SUCCESS;
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/configuration_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_impl.c b/config_admin/service/private/src/configuration_impl.c
index 6897e75..9462a9a 100644
--- a/config_admin/service/private/src/configuration_impl.c
+++ b/config_admin/service/private/src/configuration_impl.c
@@ -48,35 +48,54 @@
#include "configuration_admin_factory.h"
#include "configuration_store.h"
-struct configuration{
+struct configuration_impl {
configuration_admin_factory_pt configurationAdminFactory;
- configuration_store_pt configurationStore;
+ configuration_store_pt configurationStore;
- char *bundleLocation;
- char *factoryPid;
- char *pid;
- properties_pt dictionary;
+ configuration_pt configuration_interface;
+ char *bundleLocation;
+ char *factoryPid;
+ char *pid;
+ properties_pt dictionary;
- bool deleted; // Not sure if it's needed
- bundle_pt boundBundle;
+ bool deleted; // Not sure if it's needed
+ bundle_pt boundBundle;
celix_thread_mutex_t mutex;
};
+
+// External interface functions
+// see configuration.h
+celix_status_t configuration_delete(void* configuration);
+celix_status_t configuration_equals(void* thisConfiguration, void* otherConfiguration, bool *equals);
+celix_status_t configuration_getBundleLocation(void *configuration, char **bundleLocation);
+celix_status_t configuration_getFactoryPid(void *handle, char **factoryPid);
+celix_status_t configuration_hashCode(void *handle, int *hashCode);
+celix_status_t configuration_setBundleLocation(void *handle, char *bundleLocation);
+celix_status_t configuration_update(void *handle, properties_pt properties);
+
+
+// Configuration admin internal functions
+// see configuration_impl.h
+//static celix_status_t configuration_getBundleLocation2(configuration_impl_pt configuration, bool checkPermission, char **location);
+
+
+// static functions
+
// org.eclipse.equinox.internal.cm
-celix_status_t configuration_lock(configuration_pt configuration);
-celix_status_t configuration_unlock(configuration_pt configuration);
-celix_status_t configuration_getBundleLocation2(configuration_pt configuration, bool checkPermission, char **location);
-celix_status_t configuration_getFactoryPid2(configuration_pt configuration, bool checkDeleted, char **factoryPid);
-celix_status_t configuration_getPid2(configuration_pt configuration, bool checkDeleted, char **pid);
-static celix_status_t configuration_updateDictionary(configuration_pt configuration, properties_pt properties);
+static celix_status_t configuration_getFactoryPid2(configuration_impl_pt configuration, bool checkDeleted, char **factoryPid);
+static celix_status_t configuration_getPid2(configuration_impl_pt configuration, bool checkDeleted, char **pid);
+static celix_status_t configuration_updateDictionary(configuration_impl_pt configuration, properties_pt properties);
// org.apache.felix.cm.impl
-static celix_status_t configuration_setBundleLocationProperty(configuration_pt configuration, properties_pt *properties);
-static celix_status_t configuration_setAutoProperties(configuration_pt configuration, properties_pt *properties, bool withBundleLocation);
+static celix_status_t configuration_setBundleLocationProperty(configuration_impl_pt configuration, properties_pt *properties);
+static celix_status_t configuration_setAutoProperties(configuration_impl_pt configuration, properties_pt *properties, bool withBundleLocation);
+
+static celix_status_t configuration_checkDeleted(configuration_impl_pt configuration);
/* ========== CONSTRUCTOR ========== */
@@ -86,35 +105,63 @@ celix_status_t configuration_create( configuration_admin_factory_pt factory, con
char *factoryPid, char *pid, char *bundleLocation,
configuration_pt *configuration){
- configuration_pt config;
+ struct configuration *config;
+ struct configuration_impl *conf_impl;
celix_thread_mutexattr_t mutex_attr;
-
+ config = calloc(1, sizeof(struct configuration));
+ if (config == NULL) return CELIX_ENOMEM;
+ conf_impl = calloc(1, sizeof(struct configuration_impl));
+ if (conf_impl == NULL) {
+ free (config);
+ return CELIX_ENOMEM;
+ }
+
+ config->configuration_delete = configuration_delete;
+ config->configuration_equals = configuration_equals;
+ config->configuration_getBundleLocation = configuration_getBundleLocation;
+ config->configuration_getFactoryPid = configuration_getFactoryPid;
+ config->configuration_getPid = configuration_getPid;
+ config->configuration_getProperties = configuration_getProperties;
+ config->configuration_hashCode = configuration_hashCode;
+ config->configuration_setBundleLocation = configuration_setBundleLocation;
+ config->configuration_update = configuration_update;
+/*
config = calloc(1,sizeof(struct configuration));
if(!config){
printf("[ ERROR ]: Configuration{PID=%s} - Not created (ENOMEM) \n",pid);
return CELIX_ENOMEM;
}
-
- config->configurationAdminFactory = factory;
- config->configurationStore = store;
-
- config->factoryPid = factoryPid;
- config->pid = pid;
- config->bundleLocation = bundleLocation;
- config->dictionary = NULL;
-
- config->deleted = false;
- config->boundBundle = NULL;
+*/
+ conf_impl->configurationAdminFactory = factory;
+ conf_impl->configurationStore = store;
+
+ if (factoryPid != NULL)
+ conf_impl->factoryPid = strdup(factoryPid);
+ else
+ conf_impl->factoryPid = NULL;
+ if (pid != NULL)
+ conf_impl->pid = strdup(pid);
+ else
+ conf_impl->pid = NULL;
+ if (bundleLocation != NULL)
+ conf_impl->bundleLocation = strdup(bundleLocation);
+ else
+ conf_impl->bundleLocation = NULL;
+ conf_impl->dictionary = NULL;
+
+ conf_impl->deleted = false;
+ conf_impl->boundBundle = NULL;
celixThreadMutexAttr_create(&mutex_attr);
celixThreadMutexAttr_settype(&mutex_attr, CELIX_THREAD_MUTEX_RECURSIVE); // why recursive?
- if( celixThreadMutex_create(&config->mutex, &mutex_attr) != CELIX_SUCCESS ){
+ if( celixThreadMutex_create(&conf_impl->mutex, &mutex_attr) != CELIX_SUCCESS ){
printf("[ ERROR ]: Configuration{PID=%s} - Not created (MUTEX) \n",pid);
return CELIX_ILLEGAL_ARGUMENT;
}
- printf("[ SUCCESS]: Configuration{PID=%s} - Created \n", pid);
+ conf_impl->configuration_interface = config;
+ config->handle = conf_impl;
*configuration = config;
return CELIX_SUCCESS;
}
@@ -124,35 +171,63 @@ celix_status_t configuration_create2(configuration_admin_factory_pt factory, con
configuration_pt *configuration){
configuration_pt config;
+ configuration_impl_pt conf_impl;
+
celix_thread_mutexattr_t mutex_attr;
+ char *value;
config = calloc(1, sizeof(struct configuration));
- if(!config){
- printf("[ ERROR ]: Configuration - Not created (ENOMEM) \n");
- return CELIX_ENOMEM;
- }
-
- config->configurationAdminFactory = factory;
- config->configurationStore = store;
-
- config->factoryPid = properties_get(dictionary,(char *)SERVICE_FACTORYPID);
- config->pid = properties_get(dictionary, (char *)OSGI_FRAMEWORK_SERVICE_PID);
- config->bundleLocation = properties_get(dictionary, (char *)SERVICE_BUNDLELOCATION);
- config->dictionary = NULL;
-
- config->deleted = false;
- config->boundBundle = NULL;
+ if (config == NULL) return CELIX_ENOMEM;
+ conf_impl = calloc(1, sizeof(struct configuration_impl));
+ if (conf_impl == NULL) {
+ free (config);
+ return CELIX_ENOMEM;
+ }
+
+ config->configuration_delete = configuration_delete;
+ config->configuration_equals = configuration_equals;
+ config->configuration_getBundleLocation = configuration_getBundleLocation;
+ config->configuration_getFactoryPid = configuration_getFactoryPid;
+ config->configuration_getPid = configuration_getPid;
+ config->configuration_getProperties = configuration_getProperties;
+ config->configuration_hashCode = configuration_hashCode;
+ config->configuration_setBundleLocation = configuration_setBundleLocation;
+ config->configuration_update = configuration_update;
+
+ conf_impl->configurationAdminFactory = factory;
+ conf_impl->configurationStore = store;
+
+ value = properties_get(dictionary,(char *)SERVICE_FACTORYPID);
+ if (value != NULL)
+ conf_impl->factoryPid = strdup(value);
+ else
+ conf_impl->factoryPid = NULL;
+ value = properties_get(dictionary, (char *)OSGI_FRAMEWORK_SERVICE_PID);
+ if (value != NULL)
+ conf_impl->pid = strdup(value);
+ else
+ conf_impl->pid = NULL;
+ value = properties_get(dictionary, (char *)SERVICE_BUNDLELOCATION);
+ if (value != NULL)
+ conf_impl->bundleLocation = strdup(value);
+ else
+ conf_impl->bundleLocation = NULL;
+ conf_impl->dictionary = NULL;
+
+ conf_impl->deleted = false;
+ conf_impl->boundBundle = NULL;
celixThreadMutexAttr_create(&mutex_attr);
celixThreadMutexAttr_settype(&mutex_attr, CELIX_THREAD_MUTEX_RECURSIVE); // why recursive?
- if( celixThreadMutex_create(&config->mutex, &mutex_attr) != CELIX_SUCCESS ){
- printf("[ ERROR ]: Configuration{PID=%s} - Not created (MUTEX) \n", config->pid);
+ if( celixThreadMutex_create(&conf_impl->mutex, &mutex_attr) != CELIX_SUCCESS ){
+ printf("[ ERROR ]: Configuration{PID=%s} - Not created (MUTEX) \n", conf_impl->pid);
return CELIX_ILLEGAL_ARGUMENT;
}
celixThreadMutexAttr_destroy(&mutex_attr);
- configuration_updateDictionary(config, dictionary);
+ configuration_updateDictionary(conf_impl, dictionary);
- printf("[ SUCCESS]: Configuration{PID=%s} - Created \n", config->pid);
+ conf_impl->configuration_interface = config;
+ config->handle = conf_impl;
*configuration = config;
return CELIX_SUCCESS;
@@ -164,159 +239,169 @@ celix_status_t configuration_create2(configuration_admin_factory_pt factory, con
/* ---------- public ---------- */
// specifications
-celix_status_t configuration_delete(configuration_pt configuration){
+celix_status_t configuration_delete(void *handle){
+ configuration_impl_pt conf = (configuration_impl_pt)handle;
+
printf("TODO: Implement configuration_delete\n");
- celixThreadMutex_destroy(&configuration->mutex);
+ celixThreadMutex_destroy(&conf->mutex);
+ if (conf->factoryPid != NULL)
+ free(conf->factoryPid);
+ if (conf->pid != NULL)
+ free(conf->pid);
+ if (conf->bundleLocation != NULL)
+ free(conf->bundleLocation);
+ free(conf->configuration_interface);
+ free(conf);
return CELIX_SUCCESS;
}
-celix_status_t configuration_equals(configuration_pt thisConfiguration, configuration_pt otherConfiguration, bool *equals){
+celix_status_t configuration_equals(void* thisConfiguration, void *otherConfiguration, bool *equals){
return CELIX_SUCCESS;
}
-celix_status_t configuration_getBundleLocation(configuration_pt configuration, char **bundleLocation){
- return configuration_getBundleLocation2( configuration, true, bundleLocation);
+celix_status_t configuration_getBundleLocation(void *handle, char **bundleLocation){
+ return configuration_getBundleLocation2( handle, true, bundleLocation);
}
-celix_status_t configuration_getFactoryPid(configuration_pt configuration, char **factoryPid){
- return configuration_getFactoryPid2(configuration, true, factoryPid);
+celix_status_t configuration_getFactoryPid(void *handle, char **factoryPid){
+ return configuration_getFactoryPid2(handle, true, factoryPid);
}
-celix_status_t configuration_getPid(configuration_pt configuration, char **pid){
- return configuration_getPid2(configuration, true, pid);
+celix_status_t configuration_getPid(void *handle, char **pid){
+ return configuration_getPid2(handle, true, pid);
}
-celix_status_t configuration_getProperties(configuration_pt configuration, properties_pt *properties){
+celix_status_t configuration_getProperties(void *handle, properties_pt *properties){
- printf("[ DEBUG ]: Configuration{PID=%s} - getProperties \n",configuration->pid);
+ configuration_impl_pt conf = (configuration_impl_pt) handle;
- properties_pt copy = configuration->dictionary;
+ properties_pt copy = conf->dictionary;
// (1) configuration.lock
- configuration_lock(configuration);
+ configuration_lock(conf);
// (2) configuration.checkDeleted
- if ( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
- configuration_unlock(configuration);
+ if ( configuration_checkDeleted(conf) != CELIX_SUCCESS ){
+ configuration_unlock(conf);
return CELIX_ILLEGAL_STATE;
}
// (3) Have the Configuration properties ?
- if ( configuration->dictionary == NULL ){
- printf("[ DEBUG ]: configuration_getProperties results NULL \n");
+ if ( conf->dictionary == NULL ){
*properties = NULL;
- configuration_unlock(configuration);
+ configuration_unlock(conf);
return CELIX_SUCCESS;
}
// (4) configuration.setAutoProperties
- if ( configuration_setAutoProperties(configuration, ©, false) != CELIX_SUCCESS ){
- configuration_unlock(configuration);
+ if ( configuration_setAutoProperties(conf, ©, false) != CELIX_SUCCESS ){
+ configuration_unlock(conf);
return CELIX_ILLEGAL_ARGUMENT;
}
// (5) return
*properties = copy;
- configuration_unlock(configuration);
+ configuration_unlock(conf);
return CELIX_SUCCESS;
}
-celix_status_t configuration_hashCode(configuration_pt configuration, int *hashCode){
+celix_status_t configuration_hashCode(void *handle, int *hashCode){
return CELIX_SUCCESS;
}
-celix_status_t configuration_setBundleLocation(configuration_pt configuration, char *bundleLocation){
+celix_status_t configuration_setBundleLocation(void *handle, char *bundleLocation){
- configuration_lock(configuration);
+ configuration_impl_pt conf = (configuration_impl_pt)handle;
+ configuration_lock(conf);
- if ( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
- configuration_unlock(configuration);
+ if ( configuration_checkDeleted(conf) != CELIX_SUCCESS ){
+ configuration_unlock(conf);
return CELIX_ILLEGAL_STATE;
}
// TODO configurationAdminFactory.checkConfigurationPermission
- configuration->bundleLocation = bundleLocation;
- configuration->boundBundle = NULL; // always reset the boundBundle when setBundleLocation is called
+ conf->bundleLocation = bundleLocation;
+ conf->boundBundle = NULL; // always reset the boundBundle when setBundleLocation is called
- configuration_unlock(configuration);
+ configuration_unlock(conf);
return CELIX_SUCCESS;
}
-celix_status_t configuration_update(configuration_pt configuration, properties_pt properties){
+celix_status_t configuration_update(void *handle, properties_pt properties){
+
+ configuration_impl_pt conf = (configuration_impl_pt)handle;
- printf("[ DEBUG ]: Configuration{PID=%s} - update \n", configuration->pid);
celix_status_t status;
// (1)
- configuration_lock(configuration);
+ configuration_lock(conf);
// (2)
- if ( configuration_checkDeleted(configuration) != CELIX_SUCCESS ){
- configuration_unlock(configuration);
+ if ( configuration_checkDeleted(conf) != CELIX_SUCCESS ){
+ configuration_unlock(conf);
return CELIX_ILLEGAL_STATE;
}
// (3)
- configuration_updateDictionary(configuration,properties);
+ configuration_updateDictionary(conf, properties);
// (4)
- status = configurationStore_saveConfiguration(configuration->configurationStore,configuration->pid,configuration);
+ status = configurationStore_saveConfiguration(conf->configurationStore, conf->pid, conf->configuration_interface);
if (status != CELIX_SUCCESS){
- configuration_unlock(configuration);
+ configuration_unlock(conf);
return status;
}
// (5)
bool isFactory;
- if (configuration->factoryPid == NULL){
+ if (conf->factoryPid == NULL){
isFactory = false;
} else{
isFactory = true;
}
- status = configurationAdminFactory_notifyConfigurationUpdated(configuration->configurationAdminFactory, configuration, isFactory);
+ status = configurationAdminFactory_notifyConfigurationUpdated(conf->configurationAdminFactory, conf->configuration_interface, isFactory);
if (status != CELIX_SUCCESS){
- configuration_unlock(configuration);
+ configuration_unlock(conf);
return status;
}
// (6)
- status = configurationAdminFactory_dispatchEvent(configuration->configurationAdminFactory, CONFIGURATION_EVENT_CM_UPDATED, configuration->factoryPid, configuration->pid);
+ status = configurationAdminFactory_dispatchEvent(conf->configurationAdminFactory, CONFIGURATION_EVENT_CM_UPDATED, conf->factoryPid, conf->pid);
if (status != CELIX_SUCCESS){
- configuration_unlock(configuration);
+ configuration_unlock(conf);
return status;
}
// (7)
- configuration_unlock(configuration);
- printf("[ SUCCESS ]: Configuration{PID=%s} - update \n",configuration->pid);
+ configuration_unlock(conf);
return CELIX_SUCCESS;
}
/* ---------- protected ---------- */
// org.eclipse.equinox.cm.impl
-celix_status_t configuration_lock(configuration_pt configuration){
+celix_status_t configuration_lock(configuration_impl_pt configuration){
// printf("[ DEBUG ]: Configuration{PID=%s} - LOCK \n",configuration->pid);
celixThreadMutex_lock(&configuration->mutex);
return CELIX_SUCCESS;
}
-celix_status_t configuration_unlock(configuration_pt configuration){
+celix_status_t configuration_unlock(configuration_impl_pt configuration){
// printf("[ DEBUG ]: Configuration{PID=%s} - UNLOCK \n",configuration->pid);
celixThreadMutex_unlock(&configuration->mutex);
return CELIX_SUCCESS;
}
-celix_status_t configuration_checkLocked(configuration_pt configuration){
+celix_status_t configuration_checkLocked(configuration_impl_pt configuration){
// Not used
return CELIX_SUCCESS;
}
-celix_status_t configuration_bind(configuration_pt configuration, bundle_pt bundle, bool *isBind){
+celix_status_t configuration_bind(configuration_impl_pt configuration, bundle_pt bundle, bool *isBind){
- printf("[ DEBUG ]: Configuration{PID=%s} - bind(START) \n",configuration->pid);
+// printf("[ DEBUG ]: Configuration{PID=%s} - bind(START) \n",configuration->pid);
char *bundleLocation;
@@ -339,14 +424,14 @@ celix_status_t configuration_bind(configuration_pt configuration, bundle_pt bund
if ( strcmp(configuration->bundleLocation, bundleLocation) == 0 ){ // (3): Yes
// bind up configuration with bundle
configuration->boundBundle = bundle;
- printf("[ DEBUG ]: Configuration{PID=%s} - bind (bound with Bundle{%s}) \n",configuration->pid,bundleLocation);
+// printf("[ DEBUG ]: Configuration{PID=%s} - bind (bound with Bundle{%s}) \n",configuration->pid,bundleLocation);
}
// (3): No
}else{// (2): No
// bind up configuration with bundle
configuration->boundBundle = bundle;
- printf("[ DEBUG ]: Configuration{PID=%s}) - bind (not located and now bound with Bundle) \n",configuration->pid);
+// printf("[ DEBUG ]: Configuration{PID=%s}) - bind (not located and now bound with Bundle) \n",configuration->pid);
}
}// (1): Yes
@@ -364,16 +449,16 @@ celix_status_t configuration_bind(configuration_pt configuration, bundle_pt bund
configuration_unlock(configuration);
*isBind = bind;
- printf("[ DEBUG ]: Configuration{PID=%s} - bind(END) \n",configuration->pid);
+// printf("[ DEBUG ]: Configuration{PID=%s} - bind(END) \n",configuration->pid);
return CELIX_SUCCESS;
}
-celix_status_t configuration_unbind(configuration_pt configuration, bundle_pt bundle){
+celix_status_t configuration_unbind(configuration_impl_pt configuration, bundle_pt bundle){
return CELIX_SUCCESS;
}
-celix_status_t configuration_getBundleLocation2(configuration_pt configuration, bool checkPermission, char **location){
+celix_status_t configuration_getBundleLocation2(configuration_impl_pt configuration, bool checkPermission, char **location){
celix_status_t status;
@@ -413,13 +498,11 @@ celix_status_t configuration_getBundleLocation2(configuration_pt configuration,
return CELIX_SUCCESS;
}
-celix_status_t configuration_getFactoryPid2(configuration_pt configuration, bool checkDeleted, char **factoryPid){
+static celix_status_t configuration_getFactoryPid2(configuration_impl_pt configuration, bool checkDeleted, char **factoryPid){
return CELIX_SUCCESS;
}
-celix_status_t configuration_getPid2(configuration_pt configuration, bool checkDeleted, char **pid){
-
- printf("[ DEBUG ]: Configuration{PID=%s} - getPid \n", configuration->pid);
+static celix_status_t configuration_getPid2(configuration_impl_pt configuration, bool checkDeleted, char **pid){
configuration_lock(configuration);
@@ -439,7 +522,7 @@ celix_status_t configuration_getPid2(configuration_pt configuration, bool checkD
// org.eclipse.equinox.internal.cm modified to fit with org.apache.felix.cm.impl
// change due to ConfigurationStore implementation
-celix_status_t configuration_getAllProperties(configuration_pt configuration, properties_pt *properties){
+celix_status_t configuration_getAllProperties(configuration_impl_pt configuration, properties_pt *properties){
celix_status_t status;
@@ -485,13 +568,13 @@ celix_status_t configuration_getAllProperties(configuration_pt configuration, pr
}
-celix_status_t configuration_isDeleted(configuration_pt configuration, bool *isDeleted){
+celix_status_t configuration_isDeleted(configuration_impl_pt configuration, bool *isDeleted){
return CELIX_SUCCESS;
}
/* ---------- private ---------- */
-celix_status_t configuration_checkDeleted(configuration_pt configuration){
+celix_status_t configuration_checkDeleted(configuration_impl_pt configuration){
if ( configuration->deleted ){
printf("[CELIX_ILLEGAL_STATE ]: configuration(pid=%s) deleted \n", configuration->pid);
@@ -502,7 +585,7 @@ celix_status_t configuration_checkDeleted(configuration_pt configuration){
}
// configuration->dictionary must not contain keys reserved to ConfigAdmin (i.e. "service.pid")
-celix_status_t configuration_updateDictionary(configuration_pt configuration, properties_pt properties){
+celix_status_t configuration_updateDictionary(configuration_impl_pt configuration, properties_pt properties){
properties_pt newDictionary = NULL;
@@ -528,7 +611,7 @@ celix_status_t configuration_updateDictionary(configuration_pt configuration, pr
/* ---------- protected ---------- */
#if 0
-celix_status_t configuration_getPool(configuration_pt configuration, apr_pool_t **pool){
+celix_status_t configuration_getPool(configuration_impl_pt configuration, apr_pool_t **pool){
printf("[ DEBUG ]: Configuration{PID=%s} - get Pool \n",configuration->pid);
@@ -546,7 +629,7 @@ celix_status_t configuration_getPool(configuration_pt configuration, apr_pool_t
// properties_pt as input and output
-celix_status_t configuration_setAutoProperties(configuration_pt configuration, properties_pt *properties, bool withBundleLocation){
+celix_status_t configuration_setAutoProperties(configuration_impl_pt configuration, properties_pt *properties, bool withBundleLocation){
//(1) configuration.lock
configuration_lock(configuration);
@@ -575,7 +658,7 @@ celix_status_t configuration_setAutoProperties(configuration_pt configuration, p
}
-celix_status_t configuration_setBundleLocationProperty(configuration_pt configuration, properties_pt *properties){
+celix_status_t configuration_setBundleLocationProperty(configuration_impl_pt configuration, properties_pt *properties){
char *boundLocation;
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/configuration_store.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_store.c b/config_admin/service/private/src/configuration_store.c
index 457e02a..1343568 100644
--- a/config_admin/service/private/src/configuration_store.c
+++ b/config_admin/service/private/src/configuration_store.c
@@ -44,10 +44,14 @@
#include "properties.h"
#include "utils.h"
/* celix.config_admin.private*/
+#include "configuration_admin_factory.h"
+#include "configuration.h"
#include "configuration_impl.h"
#define STORE_DIR "store"
#define PID_EXT ".pid"
+#define MAX_CONFIG_PROPERTY_LEN 128
+
struct configuration_store {
@@ -63,7 +67,7 @@ struct configuration_store {
};
static celix_status_t configurationStore_createCache(configuration_store_pt store);
-static celix_status_t configurationStore_getConfigurationFile(char *pid, char* storePath, configuration_pt configuration, int *file);
+static celix_status_t configurationStore_getConfigurationFile(char *pid, char* storePath, int *file);
static celix_status_t configurationStore_writeConfigurationFile(int fd, properties_pt properties);
static celix_status_t configurationStore_readCache(configuration_store_pt store);
static celix_status_t configurationStore_readConfigurationFile(const char *name, int size, properties_pt *dictionary);
@@ -100,7 +104,6 @@ celix_status_t configurationStore_create(bundle_context_pt context, configuratio
configurationStore_readCache((*store));
- printf("[ SUCCESS ]: ConfigStore - Initialized \n");
return CELIX_SUCCESS;
}
@@ -115,27 +118,23 @@ celix_status_t configurationStore_destroy(configuration_store_pt store) {
// org.eclipse.equinox.internal.cm
celix_status_t configurationStore_lock(configuration_store_pt store) {
celixThreadMutex_lock(&store->mutex);
- printf("[ SUCCESS ]: ConfigStore - LOCK \n");
return CELIX_SUCCESS;
}
celix_status_t configurationStore_unlock(configuration_store_pt store) {
celixThreadMutex_unlock(&store->mutex);
- printf("[ SUCCESS ]: ConfigStore - UNLOCK \n");
return CELIX_SUCCESS;
}
celix_status_t configurationStore_saveConfiguration(configuration_store_pt store, char *pid, configuration_pt configuration) {
- printf("[ DEBUG ]: ConfigStore - saveConfig{PID=%s} \n", pid);
-
celix_status_t status;
//(1) config.checkLocked
//(2) configurationStore.getFile
int configFile;
- status = configurationStore_getConfigurationFile(pid, (char *) STORE_DIR, configuration, &configFile);
+ status = configurationStore_getConfigurationFile(pid, (char *) STORE_DIR, &configFile);
if (status != CELIX_SUCCESS) {
return status;
}
@@ -143,13 +142,12 @@ celix_status_t configurationStore_saveConfiguration(configuration_store_pt store
//(4) configProperties = config.getAllProperties
properties_pt configProperties = NULL;
- status = configuration_getAllProperties(configuration, &configProperties);
+ status = configuration_getAllProperties(configuration->handle, &configProperties);
if (status != CELIX_SUCCESS) {
printf("[ ERROR ]: ConfigStore - config{PID=%s}.getAllProperties \n", pid);
return status;
}
- printf("properties_pt SIZE = %i \n", hashMap_size(configProperties));
//(5) configStore.writeFile(file,properties)
status = configurationStore_writeConfigurationFile(configFile, configProperties);
@@ -180,7 +178,6 @@ celix_status_t configurationStore_getConfiguration(configuration_store_pt store,
}
hashMap_put(store->configurations, pid, config);
- printf("[ DEBUG ]: ConfigStore - getConfig(PID=%s) (new one stored) \n", pid);
}
*configuration = config;
@@ -194,7 +191,6 @@ celix_status_t configurationStore_createFactoryConfiguration(configuration_store
celix_status_t configurationStore_findConfiguration(configuration_store_pt store, char *pid, configuration_pt *configuration) {
*configuration = hashMap_get(store->configurations, pid);
- printf("[ DEBUG ]: ConfigStore - findConfig(PID=%s) \n", pid);
return CELIX_SUCCESS;
}
@@ -218,7 +214,6 @@ celix_status_t configurationStore_createCache(configuration_store_pt store) {
int result = mkdir((const char*) STORE_DIR, 0777);
if ((result == 0) || ((result == -1) && (errno == EEXIST))) {
- printf("[ SUCCESS ]: ConfigStore - Cache OK \n");
return CELIX_SUCCESS;
}
@@ -227,22 +222,18 @@ celix_status_t configurationStore_createCache(configuration_store_pt store) {
}
-celix_status_t configurationStore_getConfigurationFile(char *pid, char* storePath, configuration_pt configuration, int *file) {
+celix_status_t configurationStore_getConfigurationFile(char *pid, char* storePath, int *file) {
// (1) The full path to the file
- char *fname = strdup((const char *) storePath);
- strcat(fname, strdup("/"));
- strcat(fname, strdup((const char *) pid));
- strcat(fname, strdup((const char *) PID_EXT));
+ char fname[PATH_MAX];
+ strcpy(fname, storePath);
+ strcat(fname, "/");
+ strcat(fname, (const char *) pid);
+ strcat(fname, (const char *) PID_EXT);
- printf("[ DEBUG ]: ConfigStore - getFile(%s) \n", fname);
// (2) configuration.getPool
-#if 0
- apr_pool_t *fpool;
- configuration_getPool(configuration, &fpool);
-#endif
// (3) file.open
- if ((*file = open((const char*) fname, O_CREAT | O_RDWR)) < 0) {
+ if ((*file = open((const char*) fname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) {
printf("[ ERROR ]: ConfigStore - getFile(IO_EXCEPTION) \n");
return CELIX_FILE_IO_EXCEPTION;
}
@@ -251,41 +242,31 @@ celix_status_t configurationStore_getConfigurationFile(char *pid, char* storePat
celix_status_t configurationStore_writeConfigurationFile(int file, properties_pt properties) {
- printf("[ DEBUG ]: ConfigStore - write \n");
-
if (properties == NULL || hashMap_size(properties) <= 0) {
return CELIX_SUCCESS;
}
// size >0
- char *buffer;
- bool iterator0 = true;
+ char buffer[128];
hash_map_iterator_pt iterator = hashMapIterator_create(properties);
while (hashMapIterator_hasNext(iterator)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
- char * line = strdup(hashMapEntry_getKey(entry));
- strcat(line, strdup("="));
- strcat(line, strdup(hashMapEntry_getValue(entry)));
- strcat(line, "\n");
+ strcpy(buffer, hashMapEntry_getKey(entry));
+ strcat(buffer, "=");
+ strcat(buffer, hashMapEntry_getValue(entry));
+ strcat(buffer, "\n");
- if (iterator0) {
- buffer = line;
- iterator0 = false;
- } else {
- strcat(buffer, strdup(line));
- }
- }
+ int buffLength = strlen((const char *) buffer);
- int buffLength = strlen((const char *) buffer);
-
- if (write(file, (const void *) buffer, buffLength) != buffLength) {
- printf("[ ERROR ]: ConfigStore - writing in Cache incomplete \n");
- return CELIX_FILE_IO_EXCEPTION;
+ if (write(file, (const void *) buffer, buffLength) != buffLength) {
+ printf("[ ERROR ]: ConfigStore - writing in Cache incomplete \n");
+ return CELIX_FILE_IO_EXCEPTION;
+ }
}
-
+ hashMapIterator_destroy(iterator);
return CELIX_SUCCESS;
}
@@ -319,15 +300,18 @@ celix_status_t configurationStore_readCache(configuration_store_pt store) {
while ((res == 0) && (dp != NULL)) {
if ((strcmp((dp->d_name), ".") != 0) && (strcmp((dp->d_name), "..") != 0) && (strpbrk(dp->d_name, "~") == NULL)) {
-
+ char storeRoot[512];
+ snprintf(storeRoot, sizeof(storeRoot), "%s/%s", STORE_DIR, dp->d_name);
// (2.1) file.readData
- if (stat(dp->d_name, &st) == 0) {
+ if (stat(storeRoot, &st) == 0) {
status = configurationStore_readConfigurationFile(dp->d_name, st.st_size, &properties);
if (status != CELIX_SUCCESS) {
closedir(cache);
return status;
}
}
+ else
+ perror("stat");
// (2.2) new configuration
status = configuration_create2(store->configurationAdminFactory, store, properties, &configuration);
if (status != CELIX_SUCCESS) {
@@ -336,7 +320,7 @@ celix_status_t configurationStore_readCache(configuration_store_pt store) {
}
// (2.3) configurations.put
- configuration_getPid(configuration, &pid);
+ configuration_getPid(configuration->handle, &pid);
hashMap_put(store->configurations, pid, configuration);
}
res = readdir_r(cache, (struct dirent*) &u, &dp);
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_impl.c b/config_admin/service/private/src/managed_service_impl.c
index ee5e797..243a57e 100644
--- a/config_admin/service/private/src/managed_service_impl.c
+++ b/config_admin/service/private/src/managed_service_impl.c
@@ -48,3 +48,8 @@ celix_status_t managedService_create(bundle_context_pt context, managed_service_
return CELIX_SUCCESS;
}
+
+celix_status_t managedService_destroy(managed_service_pt service) {
+ free(service);
+ return CELIX_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/managed_service_tracker.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_tracker.c b/config_admin/service/private/src/managed_service_tracker.c
index 104b85e..0e47ec0 100644
--- a/config_admin/service/private/src/managed_service_tracker.c
+++ b/config_admin/service/private/src/managed_service_tracker.c
@@ -55,39 +55,39 @@ struct managed_service_tracker {
configuration_admin_factory_pt configurationAdminfactory;
configuration_store_pt configurationStore;
- updated_thread_pool_t updatedThreadPool; // according to org.equinox is our "SerializableTaskQueue"
+ updated_thread_pool_pt updatedThreadPool; // according to org.equinox is our "SerializableTaskQueue"
hash_map_pt managedServices;
hash_map_pt managedServicesReferences;
celix_thread_mutex_t managedServicesReferencesMutex;
};
-static celix_status_t managedServiceTracker_createHandle(bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt store, managed_service_tracker_t *tracker);
-static celix_status_t managedServiceTracker_createCustomized(bundle_context_pt context, managed_service_tracker_t trackerHandle, service_tracker_pt *tracker);
+static celix_status_t managedServiceTracker_createHandle(bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt store, managed_service_tracker_pt *tracker);
+static celix_status_t managedServiceTracker_createCustomized(bundle_context_pt context, managed_service_tracker_pt trackerHandle, service_tracker_pt *tracker);
-static celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, service_reference_pt reference, char * pid, managed_service_service_pt service);
-//static celix_status_t managedServiceTracker_remove(managed_service_tracker_t tracker, service_reference_pt reference, char * pid);
-static celix_status_t managedServiceTracker_trackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference, managed_service_service_pt service);
-//static celix_status_t managedServiceTracker_untrackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference);
-static celix_status_t managedServiceTracker_getManagedService(managed_service_tracker_t tracker, char *pid, managed_service_service_pt *service);
-static celix_status_t managedServiceTracker_getManagedServiceReference(managed_service_tracker_t tracker, char *pid, service_reference_pt *reference);
+static celix_status_t managedServiceTracker_add(managed_service_tracker_pt tracker, service_reference_pt reference, char * pid, managed_service_service_pt service);
+static celix_status_t managedServiceTracker_remove(managed_service_tracker_pt tracker, service_reference_pt reference, char * pid);
+static celix_status_t managedServiceTracker_trackManagedService(managed_service_tracker_pt tracker, char *pid, service_reference_pt reference, managed_service_service_pt service);
+static celix_status_t managedServiceTracker_untrackManagedService(managed_service_tracker_pt tracker, char *pid, service_reference_pt reference);
+static celix_status_t managedServiceTracker_getManagedService(managed_service_tracker_pt tracker, char *pid, managed_service_service_pt *service);
+static celix_status_t managedServiceTracker_getManagedServiceReference(managed_service_tracker_pt tracker, char *pid, service_reference_pt *reference);
//static celix_status_t managedServiceTracker_getPidForManagedService(managed_service_service_pt *service, char **pid);
-static celix_status_t managedServiceTracker_asynchUpdated(managed_service_tracker_t trackerHandle, managed_service_service_pt service, properties_pt properties);
+celix_status_t managedServiceTracker_asynchUpdated(managed_service_tracker_pt trackerHandle, managed_service_service_pt service, properties_pt properties);
-static celix_status_t managedServiceTracker_getBundleContext(managed_service_tracker_t trackerHandle, bundle_context_pt *context);
+static celix_status_t managedServiceTracker_getBundleContext(managed_service_tracker_pt trackerHandle, bundle_context_pt *context);
-static celix_status_t managedServiceTracker_lockManagedServicesReferences(managed_service_tracker_t handle);
-static celix_status_t managedServiceTracker_unlockManagedServicesReferences(managed_service_tracker_t handle);
+static celix_status_t managedServiceTracker_lockManagedServicesReferences(managed_service_tracker_pt handle);
+static celix_status_t managedServiceTracker_unlockManagedServicesReferences(managed_service_tracker_pt handle);
/* ========== CONSTRUCTOR ========== */
/* ---------- public ---------- */
-celix_status_t managedServiceTracker_create(bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt store, managed_service_tracker_t *trackerHandle, service_tracker_pt *tracker) {
+celix_status_t managedServiceTracker_create(bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt store, managed_service_tracker_pt *trackerHandle, service_tracker_pt *tracker) {
celix_status_t status;
- managed_service_tracker_t managedServiceTrackerHandle;
+ managed_service_tracker_pt managedServiceTrackerHandle;
service_tracker_pt managedServiceTrackerCustomized;
status = managedServiceTracker_createHandle(context, factory, store, &managedServiceTrackerHandle);
@@ -113,12 +113,12 @@ celix_status_t managedServiceTracker_create(bundle_context_pt context, configura
/* ---------- private ---------- */
-celix_status_t managedServiceTracker_createHandle(bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt store, managed_service_tracker_t *tracker) {
+celix_status_t managedServiceTracker_createHandle(bundle_context_pt context, configuration_admin_factory_pt factory, configuration_store_pt store, managed_service_tracker_pt *tracker) {
celix_status_t status;
- updated_thread_pool_t updatedThreadPool = NULL;
- managed_service_tracker_t this = calloc(1, sizeof(*this));
+ updated_thread_pool_pt updatedThreadPool = NULL;
+ managed_service_tracker_pt this = calloc(1, sizeof(*this));
if (!this) {
printf("[ ERROR ]: TrackerInstance - Not initialized (ENOMEM) \n");
@@ -152,7 +152,7 @@ celix_status_t managedServiceTracker_createHandle(bundle_context_pt context, con
}
-celix_status_t managedServiceTracker_createCustomized(bundle_context_pt context, managed_service_tracker_t trackerHandle, service_tracker_pt *tracker) {
+celix_status_t managedServiceTracker_createCustomized(bundle_context_pt context, managed_service_tracker_pt trackerHandle, service_tracker_pt *tracker) {
celix_status_t status;
service_tracker_customizer_pt customizer = NULL;
@@ -178,13 +178,21 @@ celix_status_t managedServiceTracker_createCustomized(bundle_context_pt context,
return CELIX_SUCCESS;
}
+celix_status_t managedServiceTracker_destroy(bundle_context_pt context, managed_service_tracker_pt mgServTr, service_tracker_pt tracker) {
+ updatedThreadPool_destroy(mgServTr->updatedThreadPool);
+ celixThreadMutex_destroy(&mgServTr->managedServicesReferencesMutex);
+ serviceTracker_destroy(tracker);
+ return CELIX_SUCCESS;
+}
+
+
+
/* ========== IMPLEMENTS CUSTOMIZED TRACKER ========== */
/* ---------- public ---------- */
celix_status_t managedServiceTracker_addingService(void * handle, service_reference_pt reference, void **service) {
- printf("[ DEBUG ]: Tracker - Adding Service \n");
celix_status_t status;
@@ -192,12 +200,12 @@ celix_status_t managedServiceTracker_addingService(void * handle, service_refere
bundle_context_pt context = NULL;
- managed_service_tracker_t managedServiceTracker_i = handle; //instance
+ managed_service_tracker_pt managedServiceTracker_i = handle; //instance
managed_service_service_pt managedService_s = NULL; //service
// (1) reference.getPid
- status = serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &pid);
+ status = serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_PID, &pid);
if (status != CELIX_SUCCESS || pid == NULL) {
*service = NULL;
printf(" [ ERROR ]: Tracker - PID is NULL \n");
@@ -227,7 +235,7 @@ celix_status_t managedServiceTracker_addingService(void * handle, service_refere
return CELIX_ILLEGAL_ARGUMENT;
}
- /* DEBUG CODE */
+ /* DEBUG CODE *
service_registration_pt registration = NULL;
serviceReference_getServiceRegistration(reference, ®istration);
@@ -236,13 +244,15 @@ celix_status_t managedServiceTracker_addingService(void * handle, service_refere
printf("[ DEBUG ]: Tracker - AddingService ( SUCCESS BundleCtxt - getService{Name=%s,PID=%s} ) \n", serviceName, pid);
- /* ENF OF DEBUG CODE */
+ * ENF OF DEBUG CODE */
// (3) trackerInstance.AddManagedServiceToLocalList
configurationStore_lock(managedServiceTracker_i->configurationStore);
status = managedServiceTracker_add(managedServiceTracker_i, reference, pid, managedService_s);
-
+ if (status != CELIX_SUCCESS) {
+ bundleContext_ungetService(context, reference, NULL);
+ }
configurationStore_unlock(managedServiceTracker_i->configurationStore);
if (status != CELIX_SUCCESS) {
@@ -264,14 +274,28 @@ celix_status_t managedServiceTracker_modifiedService(void * handle, service_refe
}
celix_status_t managedServiceTracker_removedService(void * handle, service_reference_pt reference, void * service) {
- return CELIX_SUCCESS;
+ celix_status_t status = CELIX_SUCCESS;
+ char *pid;
+ managed_service_tracker_pt managedServiceTracker_i = handle; //instance
+ bundle_context_pt context;
+
+
+ status = serviceReference_getProperty(reference, (char *)OSGI_FRAMEWORK_SERVICE_PID, &pid);
+ if (status != CELIX_SUCCESS || pid == NULL){
+ return CELIX_ILLEGAL_ARGUMENT;
+ }
+ if ( managedServiceTracker_getBundleContext(managedServiceTracker_i, &context) != CELIX_SUCCESS ){
+ return CELIX_ILLEGAL_ARGUMENT;
+ }
+ status = managedServiceTracker_remove(managedServiceTracker_i, reference, pid);
+
+ return status;
+
}
/* ---------- private ---------- */
// org.eclipse.equinox.internal.cm.ManagedServiceTracker
-celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, service_reference_pt reference, char *pid, managed_service_service_pt service) {
-
- printf("[ DEBUG ]: Tracker - Add (Service{PID=%s}) \n", pid);
+celix_status_t managedServiceTracker_add(managed_service_tracker_pt tracker, service_reference_pt reference, char *pid, managed_service_service_pt service) {
celix_status_t status;
@@ -304,7 +328,7 @@ celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, serv
// (2) bind the Configuration with the ManagedService
bool dummy;
- if ((configuration_bind(configuration, bundle, &dummy) != CELIX_SUCCESS)) {
+ if ((configuration_bind(configuration->handle, bundle, &dummy) != CELIX_SUCCESS)) {
return CELIX_ILLEGAL_ARGUMENT;
}
@@ -315,11 +339,8 @@ celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, serv
// End of new code
- printf("[ SUCCESS ]: Tracker - Add (Service{PID=%s} tracked) \n", pid);
-
// TODO: It must be considered in case of fail if untrack the ManagedService
- printf("[ DEBUG ]: Tracker - Add (Service{PID=%s} AsynchUpdated - NULL props) \n", pid);
return managedServiceTracker_asynchUpdated(tracker, service, NULL);
} else {
@@ -328,13 +349,12 @@ celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, serv
} else {
- printf("[ DEBUG ]: Tracker - Add (Service{PID=%s} - LOCK Config) \n", pid);
- configuration_lock(configuration);
+ configuration_lock(configuration->handle);
if (managedServiceTracker_trackManagedService(tracker, pid, reference, service) == CELIX_SUCCESS) {
if (serviceReference_getBundle(reference, &bundle) != CELIX_SUCCESS) {
- configuration_unlock(configuration);
+ configuration_unlock(configuration->handle);
printf("[ERROR ]: Tracker - Add (Service{PID=%s} Reference - getBundle NULL)", pid);
return CELIX_ILLEGAL_ARGUMENT;
}
@@ -342,45 +362,41 @@ celix_status_t managedServiceTracker_add(managed_service_tracker_t tracker, serv
// TODO configuration.isDeleted ? - with only using one calling bundle OK
bool isBind;
- if ((configuration_bind(configuration, bundle, &isBind) == CELIX_SUCCESS) && (isBind == true)) { // config.bind(bundle)
+ if ((configuration_bind(configuration->handle, bundle, &isBind) == CELIX_SUCCESS) && (isBind == true)) { // config.bind(bundle)
- if (configuration_getProperties(configuration, &properties) != CELIX_SUCCESS) {
- configuration_unlock(configuration);
+ if (configuration_getProperties(configuration->handle, &properties) != CELIX_SUCCESS) {
+ configuration_unlock(configuration->handle);
return CELIX_ILLEGAL_ARGUMENT;
}
if (configurationAdminFactory_modifyConfiguration(tracker->configurationAdminfactory, reference, properties) != CELIX_SUCCESS) {
- configuration_unlock(configuration);
+ configuration_unlock(configuration->handle);
return CELIX_ILLEGAL_ARGUMENT;
}
- printf("[ DEBUG ]: Tracker - Add Service{PID=%s} (AsynchUpdated - existing Configuration) \n", pid);
status = managedServiceTracker_asynchUpdated(tracker, service, properties);
- printf("[ DEBUG ]: Tracker - Add Service{PID=%s} (UNLOCK Config) \n", pid);
- configuration_unlock(configuration);
+ configuration_unlock(configuration->handle);
return status;
} else {
- printf("[ WARNING ]: Tracker - Add Service{PID=%s} ( Configuration for Service could not be bound ) $s \n", pid);
- configuration_unlock(configuration);
+ configuration_unlock(configuration->handle);
return CELIX_ILLEGAL_STATE;
}
} else {
- configuration_unlock(configuration);
+ configuration_unlock(configuration->handle);
return CELIX_ILLEGAL_ARGUMENT; // the service was already tracked
}
}
}
-/* TODO
- celix_status_t managedServiceTracker_remove(managed_service_tracker_t tracker, service_reference_pt reference, char * pid){
- return CELIX_SUCCESS;
- }
- */
-celix_status_t managedServiceTracker_trackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference, managed_service_service_pt service) {
+celix_status_t managedServiceTracker_remove(managed_service_tracker_pt tracker, service_reference_pt reference, char * pid){
+ return managedServiceTracker_untrackManagedService(tracker, pid, reference);
+}
+
+celix_status_t managedServiceTracker_trackManagedService(managed_service_tracker_pt tracker, char *pid, service_reference_pt reference, managed_service_service_pt service) {
managedServiceTracker_lockManagedServicesReferences(tracker);
@@ -398,13 +414,19 @@ celix_status_t managedServiceTracker_trackManagedService(managed_service_tracker
return CELIX_SUCCESS;
}
-/* TODO
- celix_status_t managedServiceTracker_untrackManagedService(managed_service_tracker_t tracker, char *pid, service_reference_pt reference){
- return CELIX_SUCCESS;
- }
- */
+celix_status_t managedServiceTracker_untrackManagedService(managed_service_tracker_pt tracker, char *pid, service_reference_pt reference){
+ managedServiceTracker_lockManagedServicesReferences(tracker);
-celix_status_t managedServiceTracker_getManagedService(managed_service_tracker_t tracker, char *pid, managed_service_service_pt *service) {
+ if ( hashMap_containsKey(tracker->managedServicesReferences, pid) ){
+ hashMap_remove(tracker->managedServicesReferences, pid);
+ hashMap_remove(tracker->managedServices, pid);
+ }
+ managedServiceTracker_unlockManagedServicesReferences(tracker);
+ return CELIX_SUCCESS;
+
+}
+
+celix_status_t managedServiceTracker_getManagedService(managed_service_tracker_pt tracker, char *pid, managed_service_service_pt *service) {
celix_status_t status;
managed_service_service_pt serv = NULL;
@@ -424,7 +446,7 @@ celix_status_t managedServiceTracker_getManagedService(managed_service_tracker_t
return status;
}
-celix_status_t managedServiceTracker_getManagedServiceReference(managed_service_tracker_t tracker, char *pid, service_reference_pt *reference) {
+celix_status_t managedServiceTracker_getManagedServiceReference(managed_service_tracker_pt tracker, char *pid, service_reference_pt *reference) {
celix_status_t status;
service_reference_pt ref = NULL;
@@ -450,7 +472,7 @@ celix_status_t managedServiceTracker_getManagedServiceReference(managed_service_
}
*/
-celix_status_t managedServiceTracker_asynchUpdated(managed_service_tracker_t trackerHandle, managed_service_service_pt service, properties_pt properties) {
+celix_status_t managedServiceTracker_asynchUpdated(managed_service_tracker_pt trackerHandle, managed_service_service_pt service, properties_pt properties) {
return updatedThreadPool_push(trackerHandle->updatedThreadPool, service, properties);
@@ -460,13 +482,12 @@ celix_status_t managedServiceTracker_asynchUpdated(managed_service_tracker_t tra
/* ---------- public ---------- */
-celix_status_t managedServiceTracker_notifyDeleted(managed_service_tracker_t tracker, configuration_pt configuration) {
+celix_status_t managedServiceTracker_notifyDeleted(managed_service_tracker_pt tracker, configuration_pt configuration) {
return CELIX_SUCCESS;
}
-celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tracker, configuration_pt configuration) {
+celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_pt tracker, configuration_pt configuration) {
- printf("[ DEBUG ]: Tracker - NotifyUpdated \n");
char *pid;
@@ -477,12 +498,12 @@ celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tra
managed_service_service_pt service = NULL;
// (1) config.checkLocked
- if (configuration_checkLocked(configuration) != CELIX_SUCCESS) { //TODO not yet implemented
+ if (configuration_checkLocked(configuration->handle) != CELIX_SUCCESS) { //TODO not yet implemented
return CELIX_ILLEGAL_ARGUMENT;
}
// (2) config.getPid
- if (configuration_getPid(configuration, &pid) != CELIX_SUCCESS) {
+ if (configuration_getPid(configuration->handle, &pid) != CELIX_SUCCESS) {
return CELIX_ILLEGAL_ARGUMENT;
}
@@ -500,7 +521,7 @@ celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tra
// (4.2) config.bind(reference.getBundle)
bool isBind;
- if (configuration_bind(configuration, bundle, &isBind) != CELIX_SUCCESS || isBind == false) {
+ if (configuration_bind(configuration->handle, bundle, &isBind) != CELIX_SUCCESS || isBind == false) {
printf("[ ERROR ]: Tracker - Notify (Service{PID=%s} Permission Error) \n", pid);
return CELIX_ILLEGAL_STATE;
}
@@ -508,7 +529,7 @@ celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tra
// (5) if (reference != null && config.bind(reference.getBundle()))
// (5.1) properties = config.getProperties
- if (configuration_getProperties(configuration, &properties) != CELIX_SUCCESS) {
+ if (configuration_getProperties(configuration->handle, &properties) != CELIX_SUCCESS) {
printf("[ ERROR ]: Tracker - Notify (Service{PID=%s} Wrong Properties) \n", pid);
return CELIX_ILLEGAL_ARGUMENT;
}
@@ -526,36 +547,35 @@ celix_status_t managedServiceTracker_notifyUpdated(managed_service_tracker_t tra
// (5.4) asynchUpdate(service,properties)
if ((properties == NULL) || (properties != NULL && hashMap_size(properties) == 0)) {
- printf("[ DEBUG ]: Tracker - Notify (AsynchUpdated Service{PID=%s} - NULL props) \n", pid);
return managedServiceTracker_asynchUpdated(tracker, service, NULL);
} else {
- printf("[ DEBUG ]: Tracker - Notify (AsynchUpdated Service{PID=%s} - existing props) \n", pid);
return managedServiceTracker_asynchUpdated(tracker, service, properties);
}
+ return CELIX_ILLEGAL_ARGUMENT;
}
/* ---------- private ---------- */
-celix_status_t managedServiceTracker_getBundleContext(managed_service_tracker_t trackerHandle, bundle_context_pt *context) {
+celix_status_t managedServiceTracker_getBundleContext(managed_service_tracker_pt trackerHandle, bundle_context_pt *context) {
if (trackerHandle->context != NULL) {
*context = trackerHandle->context;
- return CELIX_SUCCESS;
} else {
printf("[ ERROR ]: Tracker - getBundleContext (NULL context) \n");
*context = NULL;
return CELIX_ILLEGAL_ARGUMENT;
}
+ return CELIX_SUCCESS;
}
-celix_status_t managedServiceTracker_lockManagedServicesReferences(managed_service_tracker_t handle) {
+celix_status_t managedServiceTracker_lockManagedServicesReferences(managed_service_tracker_pt handle) {
celixThreadMutex_lock(&handle->managedServicesReferencesMutex);
return CELIX_SUCCESS;
}
-celix_status_t managedServiceTracker_unlockManagedServicesReferences(managed_service_tracker_t handle) {
+celix_status_t managedServiceTracker_unlockManagedServicesReferences(managed_service_tracker_pt handle) {
celixThreadMutex_unlock(&handle->managedServicesReferencesMutex);
return CELIX_SUCCESS;
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/private/src/updated_thread_pool.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/updated_thread_pool.c b/config_admin/service/private/src/updated_thread_pool.c
index acf0afe..922bd26 100644
--- a/config_admin/service/private/src/updated_thread_pool.c
+++ b/config_admin/service/private/src/updated_thread_pool.c
@@ -65,7 +65,7 @@ static celix_status_t updatedThreadPool_wrapDataCallback(managed_service_service
/* ---------- public ---------- */
-celix_status_t updatedThreadPool_create(bundle_context_pt context, int maxThreads, updated_thread_pool_t *updatedThreadPool){
+celix_status_t updatedThreadPool_create(bundle_context_pt context, int maxThreads, updated_thread_pool_pt *updatedThreadPool){
*updatedThreadPool = calloc(1, sizeof(**updatedThreadPool));
if (!*updatedThreadPool){
@@ -87,38 +87,28 @@ celix_status_t updatedThreadPool_create(bundle_context_pt context, int maxThread
}
+celix_status_t updatedThreadPool_destroy(updated_thread_pool_pt pool) {
+ thpool_destroy(pool->threadPool);
+ free(pool);
+ return CELIX_SUCCESS;
+}
/* ========== IMPLEMENTATION ========== */
/* ---------- public ---------- */
-celix_status_t updatedThreadPool_push(updated_thread_pool_t updatedThreadPool, managed_service_service_pt service, properties_pt properties){
+celix_status_t updatedThreadPool_push(updated_thread_pool_pt updatedThreadPool, managed_service_service_pt service, properties_pt properties){
data_callback_t data = NULL;
- // TODO apr_thread_mutex_lock(instance->mutex)?
-// if ( apr_thread_pool_busy_count(updatedThreadPool->threadPool) < updatedThreadPool->maxTreads ) {
-
- if ( updatedThreadPool_wrapDataCallback(service, properties, &data) != CELIX_SUCCESS ){
- return CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (thpool_add_work(updatedThreadPool->threadPool, updateThreadPool_updatedCallback, data) == 0) {
-// if ( apr_thread_pool_push(updatedThreadPool->threadPool, updateThreadPool_updatedCallback, data,
-// APR_THREAD_TASK_PRIORITY_NORMAL, NULL) != APR_SUCCESS ){
-
- printf("[ ERROR ]: UpdatedThreadPool - Push (apr_thread_pool_push) \n ");
- return CELIX_ILLEGAL_STATE;
-
- }
-
-// } else {
-
-// printf("[ ERROR ]: UpdatedThreadPool - Push (Full!) \n ");
-// return CELIX_ILLEGAL_STATE;
+ if ( updatedThreadPool_wrapDataCallback(service, properties, &data) != CELIX_SUCCESS ){
+ return CELIX_ILLEGAL_ARGUMENT;
+ }
-// }
+ if (thpool_add_work(updatedThreadPool->threadPool, updateThreadPool_updatedCallback, data) != 0) {
+ printf("[ ERROR ]: UpdatedThreadPool - add_work \n ");
+ return CELIX_ILLEGAL_STATE;
+ }
- printf("[ SUCCESS ]: UpdatedThreadPool - Push \n");
return CELIX_SUCCESS;
}
@@ -126,9 +116,6 @@ celix_status_t updatedThreadPool_push(updated_thread_pool_t updatedThreadPool, m
void *updateThreadPool_updatedCallback(void *data) {
-
- printf("[ DEBUG ]: UpdatedThreadPool - Callback \n");
-
data_callback_t params = data;
managed_service_service_pt managedServiceService = params->managedServiceService;
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/public/include/configuration.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration.h b/config_admin/service/public/include/configuration.h
index b872d23..f25af23 100644
--- a/config_admin/service/public/include/configuration.h
+++ b/config_admin/service/public/include/configuration.h
@@ -35,9 +35,32 @@
#include "properties.h"
+// Note: the term interface is used because configuration is not a service, it is not
+// registered in the service registry but it is owned by the config_admin
+struct configuration
+{
+ void *handle; // pointer to configuration datastore
+ /* METHODS */
+ celix_status_t (*configuration_delete)(void *handle);
+
+ celix_status_t (*configuration_equals)(void *thisConfiguration, void *otherConfiguration, bool *equals);
+
+ celix_status_t (*configuration_getBundleLocation)(void *handle, char **bundleLocation);
+ celix_status_t (*configuration_getFactoryPid)(void *handle, char **factoryPid);
+ celix_status_t (*configuration_getPid)(void *handle, char **pid);
+ celix_status_t (*configuration_getProperties)(void *handle, properties_pt *properties);
+
+ celix_status_t (*configuration_hashCode)(void *handle, int *hashCode);
+
+ celix_status_t (*configuration_setBundleLocation)(void *handle, char *bundleLocation);
+
+ celix_status_t (*configuration_update)(void *handle, properties_pt properties);
+
+};
+
typedef struct configuration *configuration_pt;
-/* METHODS */
+/* METHODS
celix_status_t configuration_delete(configuration_pt configuration);
celix_status_t configuration_equals(configuration_pt thisConfiguration, configuration_pt otherConfiguration, bool *equals);
@@ -52,6 +75,6 @@ celix_status_t configuration_hashCode(configuration_pt configuration, int *hashC
celix_status_t configuration_setBundleLocation(configuration_pt configuration, char *bundleLocation);
celix_status_t configuration_update(configuration_pt configuration, properties_pt properties);
-
+*/
#endif /* CONFIGURATION_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/service/public/include/managed_service.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/managed_service.h b/config_admin/service/public/include/managed_service.h
index 10f8570..b666e51 100644
--- a/config_admin/service/public/include/managed_service.h
+++ b/config_admin/service/public/include/managed_service.h
@@ -49,6 +49,6 @@ struct managed_service_service{
};
celix_status_t managedService_create(bundle_context_pt context, managed_service_service_pt *service);
-
+celix_status_t managedService_destroy(managed_service_pt service);
#endif /* MANAGED_SERVICE_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/framework/private/src/service_registry.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_registry.c b/framework/private/src/service_registry.c
index daa030f..ab9c324 100644
--- a/framework/private/src/service_registry.c
+++ b/framework/private/src/service_registry.c
@@ -649,7 +649,9 @@ celix_status_t serviceRegistry_ungetService(service_registry_pt registry, bundle
if (count == 0) {
serviceReference_getService(reference, &service);
serviceReference_getServiceRegistration(reference, ®);
- serviceRegistration_ungetService(reg, bundle, &service);
+ if (reg != NULL) {
+ serviceRegistration_ungetService(reg, bundle, &service);
+ }
}
} else {
serviceRegistry_logIllegalReference(registry, reference, refStatus);
[11/51] celix git commit: CELIX-330: temporarily disable rsa_shm test
Posted by pn...@apache.org.
CELIX-330: temporarily disable rsa_shm test
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/05f3af9d
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/05f3af9d
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/05f3af9d
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 05f3af9d1ff28182dea64985366680c22ba01a37
Parents: 82c8c67
Author: Bjoern Petri <bp...@apache.org>
Authored: Thu Jan 7 20:30:02 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Thu Jan 7 20:30:02 2016 +0100
----------------------------------------------------------------------
.../remote_service_admin_shm/private/test/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/05f3af9d/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt b/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
index 0786a6d..06d2ff2 100644
--- a/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
+++ b/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
@@ -53,6 +53,6 @@ configure_file(server.properties.in server.properties @ONLY)
add_dependencies(test_rsa_shm remote_service_admin_shm calculator org.apache.celix.calc.api.Calculator_proxy org.apache.celix.calc.api.Calculator_endpoint)
-add_test(NAME run_test_rsa_shm COMMAND test_rsa_shm)
-SETUP_TARGET_FOR_COVERAGE(test_rsa_shm_cov test_rsa_shm ${CMAKE_BINARY_DIR}/coverage/test_rsa_shm/test_rsa_shm)
+#add_test(NAME run_test_rsa_shm COMMAND test_rsa_shm)
+#SETUP_TARGET_FOR_COVERAGE(test_rsa_shm_cov test_rsa_shm ${CMAKE_BINARY_DIR}/coverage/test_rsa_shm/test_rsa_shm)
[17/51] celix git commit: CEIX-330: Add Readme,
describing the commonly used RSA code
Posted by pn...@apache.org.
CEIX-330: Add Readme, describing the commonly used RSA code
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/8352b231
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/8352b231
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/8352b231
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 8352b2314b6a23786aebfde2becc365470a77550
Parents: fe8d6b1
Author: Bjoern Petri <bp...@apache.org>
Authored: Sun Jan 10 12:38:21 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sun Jan 10 12:38:21 2016 +0100
----------------------------------------------------------------------
remote_services/remote_service_admin/README.md | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/8352b231/remote_services/remote_service_admin/README.md
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin/README.md b/remote_services/remote_service_admin/README.md
new file mode 100644
index 0000000..a2ee5cd
--- /dev/null
+++ b/remote_services/remote_service_admin/README.md
@@ -0,0 +1,10 @@
+## Remote Service Admin
+
+The Remote Service Admin (RSA) provides the mechanisms to import and export services when instructed to do so by the Topology Manager.
+
+To delegate method calls to the actual service implementation, the RSA_SHM and the RSA_HTTP are using "endpoint/proxy" bundles, which has all the knowledge about the marshalling and unmarshalling of data for the service. The RSA_DFI implementation combines a [foreign function interface](https://en.wikipedia.org/wiki/Foreign_function_interface) technique together with manualy created descriptors.
+
+Note that this folder contains code commonly used by the RSA implementations and therefore does not include any CMAKE configuration.
+
+###### Properties
+ ENDPOINTS defines the relative directory where endpoints and proxys can be found (default: endpoints)
[23/51] celix git commit: CELIX-77: Fix issue in config_admin. Rename
handle of service_factory service from factory->handle. The factory name can
be confusing.
Posted by pn...@apache.org.
CELIX-77: Fix issue in config_admin. Rename handle of service_factory service from factory->handle. The factory name can be confusing.
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/49ddf574
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/49ddf574
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/49ddf574
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 49ddf5743940f116999cf497dfc3e95321b53c8e
Parents: e06e14a
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Jan 12 17:15:51 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Jan 12 17:15:51 2016 +0100
----------------------------------------------------------------------
config_admin/service/private/src/configuration_admin_factory.c | 6 +++---
framework/private/src/service_registration.c | 4 ++--
framework/public/include/service_factory.h | 6 +++---
log_service/private/src/log_factory.c | 4 ++--
.../rsa/private/src/import_registration_dfi.c | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/49ddf574/config_admin/service/private/src/configuration_admin_factory.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_factory.c b/config_admin/service/private/src/configuration_admin_factory.c
index 9377ba5..99afbc0 100644
--- a/config_admin/service/private/src/configuration_admin_factory.c
+++ b/config_admin/service/private/src/configuration_admin_factory.c
@@ -100,7 +100,7 @@ celix_status_t configurationAdminFactory_create( bundle_context_pt context, serv
this->managedServiceTracker = managedServiceTracker;
this->configurationStore = configurationStore;
- (*factory)->factory = this;
+ (*factory)->handle = this;
(*factory)->getService = configurationAdminFactory_getService;
(*factory)->ungetService = configurationAdminFactory_ungetService;
@@ -119,11 +119,11 @@ celix_status_t configurationAdminFactory_destroy( bundle_context_pt context, con
/* ---------- public ---------- */
-celix_status_t configurationAdminFactory_getService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service){
+celix_status_t configurationAdminFactory_getService(void *handle, bundle_pt bundle, service_registration_pt registration, void **service){
celix_status_t status;
- configuration_admin_factory_pt configAdminFactory = (configuration_admin_factory_pt) factory;
+ configuration_admin_factory_pt configAdminFactory = (configuration_admin_factory_pt)handle;
configuration_admin_service_pt confAdminService;
// TODO
http://git-wip-us.apache.org/repos/asf/celix/blob/49ddf574/framework/private/src/service_registration.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_registration.c b/framework/private/src/service_registration.c
index fb8cd0d..f78fcca 100644
--- a/framework/private/src/service_registration.c
+++ b/framework/private/src/service_registration.c
@@ -194,7 +194,7 @@ celix_status_t serviceRegistration_getService(service_registration_pt registrati
celixThreadRwlock_readLock(®istration->lock);
if (registration->isServiceFactory) {
service_factory_pt factory = registration->serviceFactory;
- status = factory->getService(factory->factory, bundle, registration, service);
+ status = factory->getService(factory->handle, bundle, registration, service);
} else {
(*service) = registration->svcObj;
}
@@ -206,7 +206,7 @@ celix_status_t serviceRegistration_ungetService(service_registration_pt registra
celixThreadRwlock_readLock(®istration->lock);
if (registration->isServiceFactory) {
service_factory_pt factory = registration->serviceFactory;
- factory->ungetService(factory->factory, bundle, registration, service);
+ factory->ungetService(factory->handle, bundle, registration, service);
}
celixThreadRwlock_unlock(®istration->lock);
return CELIX_SUCCESS;
http://git-wip-us.apache.org/repos/asf/celix/blob/49ddf574/framework/public/include/service_factory.h
----------------------------------------------------------------------
diff --git a/framework/public/include/service_factory.h b/framework/public/include/service_factory.h
index a576548..0793a40 100644
--- a/framework/public/include/service_factory.h
+++ b/framework/public/include/service_factory.h
@@ -34,9 +34,9 @@ typedef struct service_factory * service_factory_pt;
#include "bundle.h"
struct service_factory {
- void *factory;
- celix_status_t (*getService)(void *factory, bundle_pt bundle, service_registration_pt registration, void **service);
- celix_status_t (*ungetService)(void *factory, bundle_pt bundle, service_registration_pt registration, void **service);
+ void *handle;
+ celix_status_t (*getService)(void *handle, bundle_pt bundle, service_registration_pt registration, void **service);
+ celix_status_t (*ungetService)(void *handle, bundle_pt bundle, service_registration_pt registration, void **service);
};
http://git-wip-us.apache.org/repos/asf/celix/blob/49ddf574/log_service/private/src/log_factory.c
----------------------------------------------------------------------
diff --git a/log_service/private/src/log_factory.c b/log_service/private/src/log_factory.c
index c4565ba..1c0a17a 100644
--- a/log_service/private/src/log_factory.c
+++ b/log_service/private/src/log_factory.c
@@ -49,7 +49,7 @@ celix_status_t logFactory_create(log_pt log, service_factory_pt *factory) {
} else {
factoryData->log = log;
- (*factory)->factory = factoryData;
+ (*factory)->handle = factoryData;
(*factory)->getService = logFactory_getService;
(*factory)->ungetService = logFactory_ungetService;
}
@@ -62,7 +62,7 @@ celix_status_t logFactory_destroy(service_factory_pt *factory) {
celix_status_t status = CELIX_SUCCESS;
- free((*factory)->factory);
+ free((*factory)->handle);
free(*factory);
factory = NULL;
http://git-wip-us.apache.org/repos/asf/celix/blob/49ddf574/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
index eab6215..16e27a5 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
@@ -75,7 +75,7 @@ celix_status_t importRegistration_create(bundle_context_pt context, endpoint_des
celixThreadMutex_create(®->proxiesMutex, NULL);
version_createVersionFromString((char*)serviceVersion,&(reg->version));
- reg->factory->factory = reg;
+ reg->factory->handle = reg;
reg->factory->getService = (void *)importRegistration_getService;
reg->factory->ungetService = (void *)importRegistration_ungetService;
} else {
[08/51] celix git commit: CELIX-334: fix race condition in topology
manager
Posted by pn...@apache.org.
CELIX-334: fix race condition in topology manager
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/876654fa
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/876654fa
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/876654fa
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 876654fac032d1686cfbb15758671d7a8e1bc93e
Parents: a01de9e
Author: Bjoern Petri <bp...@apache.org>
Authored: Thu Jan 7 13:37:22 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Thu Jan 7 13:37:22 2016 +0100
----------------------------------------------------------------------
.../private/src/topology_manager.c | 67 +++++++-------------
1 file changed, 23 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/876654fa/remote_services/topology_manager/private/src/topology_manager.c
----------------------------------------------------------------------
diff --git a/remote_services/topology_manager/private/src/topology_manager.c b/remote_services/topology_manager/private/src/topology_manager.c
index 5e3ca72..a116383 100644
--- a/remote_services/topology_manager/private/src/topology_manager.c
+++ b/remote_services/topology_manager/private/src/topology_manager.c
@@ -362,20 +362,6 @@ celix_status_t topologyManager_rsaRemoved(void * handle, service_reference_pt re
return status;
}
-celix_status_t topologyManager_getRSAs(topology_manager_pt manager, array_list_pt *rsaList) {
- celix_status_t status;
-
- status = arrayList_create(rsaList);
-
- if (status == CELIX_SUCCESS) {
- if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
- arrayList_addAll(*rsaList, manager->rsaList);
- celixThreadMutex_unlock(&manager->rsaListLock);
- }
- }
-
- return status;
-}
celix_status_t topologyManager_serviceChanged(void *listener, service_event_pt event) {
celix_status_t status = CELIX_SUCCESS;
@@ -525,27 +511,23 @@ celix_status_t topologyManager_importScopeChanged(void *handle, char *service_na
}
celix_status_t topologyManager_addImportedService(void *handle, endpoint_description_pt endpoint, char *matchedFilter) {
- celix_status_t status;
+ celix_status_t status = CELIX_SUCCESS;
topology_manager_pt manager = handle;
- array_list_pt localRSAs = NULL;
logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Add imported service (%s; %s).", endpoint->service, endpoint->id);
- // Create a local copy of the current list of RSAs, to ensure we do not run into threading issues...
- status = topologyManager_getRSAs(manager, &localRSAs);
-
- if (status == CELIX_SUCCESS) {
+ if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
- if (celixThreadMutex_lock(&manager->importedServicesLock) == CELIX_SUCCESS) {
+ hash_map_pt imports = hashMap_create(NULL, NULL, NULL, NULL);
+ hashMap_put(manager->importedServices, endpoint, imports);
- hash_map_pt imports = hashMap_create(NULL, NULL, NULL, NULL);
- hashMap_put(manager->importedServices, endpoint, imports);
+ if (scope_allowImport(manager->scope, endpoint)) {
+ if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
+ int size = arrayList_size(manager->rsaList);
- if (scope_allowImport(manager->scope, endpoint)) {
- int size = arrayList_size(localRSAs);
for (int iter = 0; iter < size; iter++) {
import_registration_pt import = NULL;
- remote_service_admin_service_pt rsa = arrayList_get(localRSAs, iter);
+ remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
celix_status_t substatus = rsa->importService(rsa->admin, endpoint, &import);
if (substatus == CELIX_SUCCESS) {
hashMap_put(imports, rsa, import);
@@ -553,14 +535,15 @@ celix_status_t topologyManager_addImportedService(void *handle, endpoint_descrip
status = substatus;
}
}
+ celixThreadMutex_unlock(&manager->rsaListLock);
}
- celixThreadMutex_unlock(&manager->importedServicesLock);
}
- arrayList_destroy(localRSAs);
+
+ celixThreadMutex_unlock(&manager->importedServicesLock);
}
- status = CELIX_SUCCESS;
+
return status;
}
@@ -608,28 +591,25 @@ celix_status_t topologyManager_removeImportedService(void *handle, endpoint_desc
}
celix_status_t topologyManager_addExportedService(topology_manager_pt manager, service_reference_pt reference, char *serviceId) {
- celix_status_t status;
+ celix_status_t status = CELIX_SUCCESS;
properties_pt serviceProperties = NULL;
- array_list_pt localRSAs = NULL;
logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "TOPOLOGY_MANAGER: Add exported service (%s).", serviceId);
- // Create a local copy of the current list of RSAs, to ensure we do not run into threading issues...
- status = topologyManager_getRSAs(manager, &localRSAs);
+ if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
+ scope_getExportProperties(manager->scope, reference, &serviceProperties);
+ hash_map_pt exports = hashMap_create(NULL, NULL, NULL, NULL);
+ hashMap_put(manager->exportedServices, reference, exports);
- if (status == CELIX_SUCCESS) {
- if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) {
- scope_getExportProperties(manager->scope, reference, &serviceProperties);
- hash_map_pt exports = hashMap_create(NULL, NULL, NULL, NULL);
- hashMap_put(manager->exportedServices, reference, exports);
- int size = arrayList_size(localRSAs);
+ if (celixThreadMutex_lock(&manager->rsaListLock) == CELIX_SUCCESS) {
+ int size = arrayList_size(manager->rsaList);
if (size == 0) {
logHelper_log(manager->loghelper, OSGI_LOGSERVICE_WARNING, "TOPOLOGY_MANAGER: No RSA available yet.");
}
for (int iter = 0; iter < size; iter++) {
- remote_service_admin_service_pt rsa = arrayList_get(localRSAs, iter);
+ remote_service_admin_service_pt rsa = arrayList_get(manager->rsaList, iter);
array_list_pt endpoints = NULL;
celix_status_t substatus = rsa->exportService(rsa->admin, serviceId, serviceProperties, &endpoints);
@@ -641,12 +621,11 @@ celix_status_t topologyManager_addExportedService(topology_manager_pt manager, s
status = substatus;
}
}
- celixThreadMutex_unlock(&manager->exportedServicesLock);
+ celixThreadMutex_unlock(&manager->rsaListLock);
}
- arrayList_destroy(localRSAs);
-
+ celixThreadMutex_unlock(&manager->exportedServicesLock);
}
- //status = CELIX_SUCCESS;
+
return status;
}
[12/51] celix git commit: CELIX-330: Enable coverity
Posted by pn...@apache.org.
CELIX-330: Enable coverity
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/b218a6b2
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/b218a6b2
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/b218a6b2
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: b218a6b2cde08d8d2a17da80649194b1f04fb856
Parents: 05f3af9
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 8 06:49:40 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 8 06:49:40 2016 +0100
----------------------------------------------------------------------
.travis.yml | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/b218a6b2/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index fc1aa49..8cdf650 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,17 @@ compiler:
- gcc
- clang
+
+env:
+ global:
+ - COVERITY_SCAN_BUILD_COMMAND="make"
+ - COVERITY_SCAN_PROJECT_NAME="apache/celix"
+ - COVERITY_SCAN_NOTIFICATION_EMAIL="bpetri@apache.org"
+ - COVERITY_SCAN_BRANCH_PATTERN="develop"
+ - COVERITY_SCAN_TOKEN="iomLSuaE8KOZLDog-KK7Ug"
+ - COVERITY_SCAN_BUILD_URL="https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh"
+ - COVERITY_SCAN_BUILD="curl -s $COVERITY_SCAN_BUILD_URL | bash"
+
matrix:
include:
- os: linux
@@ -49,4 +60,6 @@ after_success:
gem install coveralls-lcov &&
make coverage &&
lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx && coveralls-lcov --repo-token=9dpeTAjiGoQU5hgXFe0ezk65iu40oc3WY coverage.info;
+ make clean && eval "$COVERITY_SCAN_BUILD"
+ #if [ $(( $TRAVIS_BUILD_NUMBER % 10 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
fi;
[14/51] celix git commit: CELIX-330: Adapt coverity project name
Posted by pn...@apache.org.
CELIX-330: Adapt coverity project name
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/2802d463
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/2802d463
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/2802d463
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 2802d46302027b730c853550dcdd3cb172098122
Parents: cfcb852
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 8 07:14:53 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 8 07:14:53 2016 +0100
----------------------------------------------------------------------
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/2802d463/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 062414d..62d3a8d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ compiler:
env:
global:
- COVERITY_SCAN_BUILD_COMMAND="make"
- - COVERITY_SCAN_PROJECT_NAME="apache/celix"
+ - COVERITY_SCAN_PROJECT_NAME="Apache Celix"
- COVERITY_SCAN_NOTIFICATION_EMAIL="bpetri@apache.org"
- COVERITY_SCAN_BRANCH_PATTERN="develop"
- COVERITY_SCAN_TOKEN="iomLSuaE8KOZLDog-KK7Ug"
@@ -60,5 +60,5 @@ after_success:
gem install coveralls-lcov &&
make coverage &&
lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx && coveralls-lcov --repo-token=9dpeTAjiGoQU5hgXFe0ezk65iu40oc3WY coverage.info;
- if [ $(( $TRAVIS_BUILD_NUMBER % 5 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
+ if [ $(( $TRAVIS_BUILD_NUMBER % 1 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
fi;
[21/51] celix git commit: CELIX-332: add filter tests,
fixed small bugs in the source
Posted by pn...@apache.org.
CELIX-332: add filter tests, fixed small bugs in the source
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/96650491
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/96650491
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/96650491
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 9665049158d81a235de995c3d87acc02cb7a17fc
Parents: 099fc6b
Author: Bjoern Petri <bp...@apache.org>
Authored: Mon Jan 11 16:51:06 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Mon Jan 11 16:51:06 2016 +0100
----------------------------------------------------------------------
framework/private/include/filter_private.h | 1 -
framework/private/src/filter.c | 212 ++++++----
framework/private/test/filter_test.cpp | 514 ++++++++++++++++++++++--
3 files changed, 629 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/96650491/framework/private/include/filter_private.h
----------------------------------------------------------------------
diff --git a/framework/private/include/filter_private.h b/framework/private/include/filter_private.h
index 548a6d2..d19de2d 100644
--- a/framework/private/include/filter_private.h
+++ b/framework/private/include/filter_private.h
@@ -49,7 +49,6 @@ typedef enum operand
struct filter {
OPERAND operand;
char * attribute;
- int operands;
void * value;
char *filterStr;
};
http://git-wip-us.apache.org/repos/asf/celix/blob/96650491/framework/private/src/filter.c
----------------------------------------------------------------------
diff --git a/framework/private/src/filter.c b/framework/private/src/filter.c
index bf632ff..02ebc83 100644
--- a/framework/private/src/filter.c
+++ b/framework/private/src/filter.c
@@ -31,21 +31,21 @@
#include "celix_log.h"
#include "filter_private.h"
-void filter_skipWhiteSpace(char * filterString, int * pos);
-filter_pt filter_parseFilter(char * filterString, int * pos);
-filter_pt filter_parseFilterComp(char * filterString, int * pos);
-filter_pt filter_parseAnd(char * filterString, int * pos);
-filter_pt filter_parseOr(char * filterString, int * pos);
-filter_pt filter_parseNot(char * filterString, int * pos);
-filter_pt filter_parseItem(char * filterString, int * pos);
-char * filter_parseAttr(char * filterString, int * pos);
-char * filter_parseValue(char * filterString, int * pos);
-array_list_pt filter_parseSubstring(char * filterString, int * pos);
-
-celix_status_t filter_compare(OPERAND operand, char * string, void * value2, bool *result);
-celix_status_t filter_compareString(OPERAND operand, char * string, void * value2, bool *result);
-
-void filter_skipWhiteSpace(char * filterString, int * pos) {
+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)++;
@@ -58,38 +58,43 @@ filter_pt filter_create(char * filterString) {
filter = filter_parseFilter(filterString, &pos);
if (pos != strlen(filterString)) {
fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Extraneous trailing characters.");
+ filter_destroy(filter);
return NULL;
}
- filter->filterStr = filterString;
+ if(filter != NULL){
+ filter->filterStr = filterString;
+ }
+
return filter;
}
void filter_destroy(filter_pt filter) {
if (filter != 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_clear(filter->value);
- 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);
+ 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;
}
- 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;
@@ -98,7 +103,7 @@ void filter_destroy(filter_pt filter) {
}
}
-filter_pt filter_parseFilter(char * filterString, int * pos) {
+static filter_pt filter_parseFilter(char * filterString, int * pos) {
filter_pt filter;
filter_skipWhiteSpace(filterString, pos);
if (filterString[*pos] != '(') {
@@ -113,15 +118,25 @@ filter_pt filter_parseFilter(char * filterString, int * pos) {
if (filterString[*pos] != ')') {
fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing ')'.");
+ 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;
}
-filter_pt filter_parseFilterComp(char * filterString, int * pos) {
+static filter_pt filter_parseFilterComp(char * filterString, int * pos) {
char c;
filter_skipWhiteSpace(filterString, pos);
@@ -144,22 +159,39 @@ filter_pt filter_parseFilterComp(char * filterString, int * pos) {
return filter_parseItem(filterString, pos);
}
-filter_pt filter_parseAnd(char * filterString, int * pos) {
- filter_pt filter = (filter_pt) malloc(sizeof(*filter));
+static filter_pt filter_parseAnd(char * filterString, int * pos) {
+
array_list_pt operands = NULL;
- arrayList_create(&operands);
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;
@@ -167,22 +199,40 @@ filter_pt filter_parseAnd(char * filterString, int * pos) {
return filter;
}
-filter_pt filter_parseOr(char * filterString, int * pos) {
- filter_pt filter = (filter_pt) malloc(sizeof(*filter));
+static filter_pt filter_parseOr(char * filterString, int * pos) {
+
array_list_pt operands = NULL;
- arrayList_create(&operands);
+
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;
@@ -190,9 +240,8 @@ filter_pt filter_parseOr(char * filterString, int * pos) {
return filter;
}
-filter_pt filter_parseNot(char * filterString, int * pos) {
+static filter_pt filter_parseNot(char * filterString, int * pos) {
filter_pt child = NULL;
- filter_pt filter = (filter_pt) malloc(sizeof(*filter));
filter_skipWhiteSpace(filterString, pos);
if (filterString[*pos] != '(') {
@@ -202,6 +251,8 @@ filter_pt filter_parseNot(char * filterString, int * pos) {
child = filter_parseFilter(filterString, pos);
+
+ filter_pt filter = (filter_pt) malloc(sizeof(*filter));
filter->operand = NOT;
filter->attribute = NULL;
filter->value = child;
@@ -209,8 +260,12 @@ filter_pt filter_parseNot(char * filterString, int * pos) {
return filter;
}
-filter_pt filter_parseItem(char * filterString, int * pos) {
+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 '~': {
@@ -281,17 +336,19 @@ filter_pt filter_parseItem(char * filterString, int * pos) {
filter = (filter_pt) malloc(sizeof(*filter));
(*pos)++;
subs = filter_parseSubstring(filterString, pos);
- 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;
+ 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;
@@ -301,10 +358,11 @@ filter_pt filter_parseItem(char * filterString, int * pos) {
}
}
fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid operator.");
+ free(attr);
return NULL;
}
-char * filter_parseAttr(char * filterString, int * pos) {
+static char * filter_parseAttr(char * filterString, int * pos) {
char c;
int begin = *pos;
int end = *pos;
@@ -336,7 +394,7 @@ char * filter_parseAttr(char * filterString, int * pos) {
}
}
-char * filter_parseValue(char * filterString, int * pos) {
+static char * filter_parseValue(char * filterString, int * pos) {
char *value = calloc(strlen(filterString) + 1, sizeof(*value));
int keepRunning = 1;
@@ -350,6 +408,12 @@ char * filter_parseValue(char * filterString, int * pos) {
}
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 '\\': {
@@ -370,16 +434,16 @@ char * filter_parseValue(char * filterString, int * pos) {
if (strlen(value) == 0) {
fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing value.");
+ free(value);
return NULL;
}
return value;
}
-array_list_pt filter_parseSubstring(char * filterString, int * pos) {
+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;
- int size;
arrayList_create(&operands);
while (keepRunning) {
@@ -394,9 +458,15 @@ array_list_pt filter_parseSubstring(char * filterString, int * pos) {
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.");
- return NULL;
+ keepRunning = false;
+ break;
}
case '*': {
if (strlen(sub) > 0) {
@@ -423,10 +493,10 @@ array_list_pt filter_parseSubstring(char * filterString, int * pos) {
}
}
free(sub);
- size = arrayList_size(operands);
- if (size == 0) {
+ if (arrayList_size(operands) == 0) {
fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing value.");
+ arrayList_destroy(operands);
return NULL;
}
@@ -493,7 +563,7 @@ celix_status_t filter_match(filter_pt filter, properties_pt properties, bool *re
return CELIX_SUCCESS;
}
-celix_status_t filter_compare(OPERAND operand, char * string, void * value2, bool *result) {
+static celix_status_t filter_compare(OPERAND operand, char * string, void * value2, bool *result) {
if (string == NULL) {
*result = 0;
return CELIX_SUCCESS;
@@ -502,7 +572,7 @@ celix_status_t filter_compare(OPERAND operand, char * string, void * value2, boo
}
-celix_status_t filter_compareString(OPERAND operand, char * string, void * value2, bool *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;
@@ -560,7 +630,7 @@ celix_status_t filter_compareString(OPERAND operand, char * string, void * value
*result = true;
return CELIX_SUCCESS;
}
- case APPROX:
+ case APPROX: //TODO: Implement strcmp with ignorecase and ignorespaces
case EQUAL: {
*result = (strcmp(string, (char *) value2) == 0);
return CELIX_SUCCESS;
http://git-wip-us.apache.org/repos/asf/celix/blob/96650491/framework/private/test/filter_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/filter_test.cpp b/framework/private/test/filter_test.cpp
index 2ed7485..bf07fc6 100644
--- a/framework/private/test/filter_test.cpp
+++ b/framework/private/test/filter_test.cpp
@@ -25,6 +25,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include "CppUTest/TestHarness.h"
#include "CppUTest/TestHarness_c.h"
@@ -35,61 +36,522 @@ extern "C" {
#include "filter_private.h"
#include "celix_log.h"
-framework_logger_pt logger;
+framework_logger_pt logger = (framework_logger_pt) 0x42;
}
int main(int argc, char** argv) {
return RUN_ALL_TESTS(argc, argv);
}
+static char* my_strdup(const char* s){
+ if(s==NULL){
+ return NULL;
+ }
+
+ size_t len = strlen(s);
+
+ char *d = (char*) calloc (len + 1,sizeof(char));
+
+ if (d == NULL){
+ return NULL;
+ }
+
+ strncpy (d,s,len);
+ return d;
+}
+
+//----------------TESTGROUPS----------------
TEST_GROUP(filter) {
void setup(void) {
- logger = (framework_logger_pt) malloc(sizeof(*logger));
- logger->logFunction = frameworkLogger_log;
}
void teardown() {
- mock().checkExpectations();
mock().clear();
-
- free(logger);
}
};
-TEST(filter, create) {
- char filterStr[] = "(key=value)";
- filter_pt filter = filter_create(filterStr);
+//----------------FILTER TESTS----------------
+TEST(filter, create_destroy){
+ char * filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3)))");
+ filter_pt get_filter;
+
+ get_filter = filter_create(filter_str);
+ CHECK(get_filter != NULL);
+
+ filter_destroy(get_filter);
+
+ //cleanup
+ free(filter_str);
+
+ mock().checkExpectations();
+}
+
+TEST(filter, create_fail_missing_opening_brackets){
+ char * filter_str;
+ filter_pt get_filter;
+
+ //test missing opening brackets in main filter
+ mock().expectNCalls(2, "framework_log");
+ filter_str = my_strdup("&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3))");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test missing opening brackets in AND comparator
+ mock().expectNCalls(3, "framework_log");
+ filter_str = my_strdup("(&test_attr1=attr1|(test_attr2=attr2)(test_attr3=attr3))");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test missing opening brackets in AND comparator
+ mock().expectNCalls(4, "framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(|test_attr2=attr2(test_attr3=attr3))");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test missing opening brackets in NOT comparator
+ mock().expectNCalls(4, "framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(!test_attr2=attr2)");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+}
+
+TEST(filter, create_fail_missing_closing_brackets){
+ char * filter_str;
+ filter_pt get_filter;
+ //test missing closing brackets in substring
+ mock().expectNCalls(5, "framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test missing closing brackets in value
+ mock().expectNCalls(4, "framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3>=attr3");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+}
+
+TEST(filter, create_fail_invalid_closing_brackets){
+ char * filter_str;
+ filter_pt get_filter;
+ //test missing closing brackets in substring
+ mock().expectNCalls(6, "framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=at(tr3)))");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test missing closing brackets in value
+ mock().expectNCalls(5, "framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3>=att(r3)))");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+}
+
+TEST(filter, create_misc){
+ char * filter_str;
+ filter_pt get_filter;
+ //test trailing chars
+ mock().expectOneCall("framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3))) oh no! trailing chars");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test half APPROX operator (should be "~=", instead is "~")
+ mock().expectNCalls(5, "framework_log");
+ filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3~attr3)))");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test PRESENT operator with trailing chars (should just register as substrings: "*" and "attr3")
+ filter_str = my_strdup("(test_attr3=*attr3)");
+ get_filter = filter_create(filter_str);
+ CHECK(get_filter != NULL);
+ LONGS_EQUAL(SUBSTRING, get_filter->operand)
+ LONGS_EQUAL(2, arrayList_size((array_list_pt) get_filter->value));
+ filter_destroy(get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test parsing a attribute of 0 length
+ mock().expectNCalls(3, "framework_log");
+ filter_str = my_strdup("(>=attr3)");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test parsing a value of 0 length
+ mock().expectOneCall("framework_log");
+ filter_str = my_strdup("(test_attr3>=)");
+ get_filter = filter_create(filter_str);
+ POINTERS_EQUAL(NULL, get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test parsing a value with a escaped closing bracket "\)"
+ filter_str = my_strdup("(test_attr3>=strWith\\)inIt)");
+ get_filter = filter_create(filter_str);
+ CHECK(get_filter != NULL);
+ STRCMP_EQUAL("strWith)inIt", (char*)get_filter->value);
+ filter_destroy(get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+
+ //test parsing a substring with a escaped closing bracket "\)"
+ filter_str = my_strdup("(test_attr3=strWith\\)inIt)");
+ get_filter = filter_create(filter_str);
+ CHECK(get_filter != NULL);
+ STRCMP_EQUAL("strWith)inIt", (char*)get_filter->value);
+ filter_destroy(get_filter);
+ free(filter_str);
+ mock().checkExpectations();
+}
+
+TEST(filter, match_comparators){
+ char * filter_str;
+ filter_pt filter;
+ properties_pt props = properties_create();
+ char * key = my_strdup("test_attr1");
+ char * val = my_strdup("attr1");
+ char * key2 = my_strdup("test_attr2");
+ char * val2 = my_strdup("attr2");
+ properties_set(props, key, val);
+ properties_set(props, key2, val2);
- STRCMP_EQUAL(filterStr, filter->filterStr);
+ //test AND
+ filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(!(test_attr3=attr3))))");
+ filter = filter_create(filter_str);
+ bool result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test AND false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(&(test_attr1=attr1)(test_attr1=attr2))");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //cleanup
+ properties_destroy(props);
+ filter_destroy(filter);
+ free(filter_str);
+ free(key);
+ free(key2);
+ free(val);
+ free(val2);
+
+ mock().checkExpectations();
}
+TEST(filter, match_operators){
+ char * filter_str;
+ filter_pt filter;
+ properties_pt props = properties_create();
+ char * key = my_strdup("test_attr1");
+ char * val = my_strdup("attr1");
+ char * key2 = my_strdup("test_attr2");
+ char * val2 = my_strdup("attr2");
+ properties_set(props, key, val);
+ properties_set(props, key2, val2);
+
+ //test EQUALS
+ filter_str = my_strdup("(test_attr1=attr1)");
+ filter = filter_create(filter_str);
+ bool result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test EQUALS false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1=falseString)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test APPROX TODO: update this test once APPROX is implemented
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1~=attr1)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test APROX false TODO: update this test once APPROX is implemented
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1~=ATTR1)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test PRESENT
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1=*)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test PRESENT false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr3=*)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test LESSEQUAL less
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1<=attr5)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test LESSEQUAL equals
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2<=attr2)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test LESSEQUAL false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2<=attr1)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test GREATEREQUAL greater
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2>=attr1)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test GREATEREQUAL equals
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2>=attr2)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test GREATEREQUAL false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1>=attr5)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test LESS less
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1<attr5)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test LESS equals
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2<attr2)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test LESS false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2<attr1)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
-TEST(filter, create1) {
- char filterStr[] = "(key<value)";
- filter_pt filter = filter_create(filterStr);
+ //test GREATER greater
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2>attr1)");
+ filter = filter_create(filter_str);
+ result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
- STRCMP_EQUAL(filterStr, filter->filterStr);
+ //test GREATER equals
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr2>attr2)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test GREATER false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1>attr5)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //test SUBSTRING equals
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1=attr*)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //test SUBSTRING false
+ filter_destroy(filter);
+ free(filter_str);
+ filter_str = my_strdup("(test_attr1=attr*charsNotPresent)");
+ filter = filter_create(filter_str);
+ result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
+
+ //cleanup
+ properties_destroy(props);
+ filter_destroy(filter);
+ free(filter_str);
+ free(key);
+ free(key2);
+ free(val);
+ free(val2);
+
+ mock().checkExpectations();
}
-TEST(filter, create2) {
- char filterStr[] = "(key>value)";
- filter_pt filter = filter_create(filterStr);
+TEST(filter, match_recursion){
- STRCMP_EQUAL(filterStr, filter->filterStr);
+ char * filter_str = my_strdup("(&(test_attr1=attr1)(|(&(test_attr2=attr2)(!(&(test_attr1=attr1)(test_attr3=attr3))))(test_attr3=attr3)))");
+ filter_pt filter = filter_create(filter_str);
+ properties_pt props = properties_create();
+ char * key = my_strdup("test_attr1");
+ char * val = my_strdup("attr1");
+ char * key2 = my_strdup("test_attr2");
+ char * val2 = my_strdup("attr2");
+ properties_set(props, key, val);
+ properties_set(props, key2, val2);
+
+ bool result = false;
+ filter_match(filter, props, &result);
+ CHECK(result);
+
+ //cleanup
+ properties_destroy(props);
+ filter_destroy(filter);
+ free(filter_str);
+ free(key);
+ free(key2);
+ free(val);
+ free(val2);
+
+ mock().checkExpectations();
}
-TEST(filter, create3) {
- char filterStr[] = "(key<=value)";
- filter_pt filter = filter_create(filterStr);
+TEST(filter, match_false){
+ char * filter_str = my_strdup("(&(test_attr1=attr1)(&(test_attr2=attr2)(test_attr3=attr3)))");
+ filter_pt filter = filter_create(filter_str);
+ properties_pt props = properties_create();
+ char * key = my_strdup("test_attr1");
+ char * val = my_strdup("attr1");
+ char * key2 = my_strdup("test_attr2");
+ char * val2 = my_strdup("attr2");
+ properties_set(props, key, val);
+ properties_set(props, key2, val2);
+
+ bool result = true;
+ filter_match(filter, props, &result);
+ CHECK_FALSE(result);
- STRCMP_EQUAL(filterStr, filter->filterStr);
+ //cleanup
+ properties_destroy(props);
+ filter_destroy(filter);
+ free(filter_str);
+ free(key);
+ free(key2);
+ free(val);
+ free(val2);
+
+ mock().checkExpectations();
+}
+
+TEST(filter, match_filter){
+ char * filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3)))");
+ char * compareTo_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3)))");
+ filter_pt filter = filter_create(filter_str);
+ filter_pt compareTo = filter_create(compareTo_str);
+
+ bool result;
+ filter_match_filter(filter, compareTo, &result);
+
+ //cleanup
+ filter_destroy(filter);
+ filter_destroy(compareTo);
+ free(filter_str);
+ free(compareTo_str);
+
+ mock().checkExpectations();
}
-TEST(filter, create4) {
- char filterStr[] = "(key>=value)";
- filter_pt filter = filter_create(filterStr);
+TEST(filter, getString){
+ char * filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3)))");
+ filter_pt filter = filter_create(filter_str);
+
+ char * get_str;
+ filter_getString(filter, &get_str);
+
+ //cleanup
+ filter_destroy(filter);
+ free(filter_str);
- STRCMP_EQUAL(filterStr, filter->filterStr);
+ mock().checkExpectations();
}
[25/51] celix git commit: CELIX-333: change restriction of coverity
scans to every 5th build
Posted by pn...@apache.org.
CELIX-333: change restriction of coverity scans to every 5th build
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/d8dbe106
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/d8dbe106
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/d8dbe106
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: d8dbe106b40b53478b45da17b204fa5e8fc7fdc0
Parents: 1131b82
Author: Bjoern Petri <bp...@apache.org>
Authored: Tue Jan 12 20:42:59 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Tue Jan 12 20:42:59 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/d8dbe106/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index ffe8c98..437d125 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -60,5 +60,5 @@ after_success:
gem install coveralls-lcov &&
make coverage &&
lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx && coveralls-lcov --repo-token=9dpeTAjiGoQU5hgXFe0ezk65iu40oc3WY coverage.info;
- if [ $(( $TRAVIS_BUILD_NUMBER % 10 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
+ if [ $(( $TRAVIS_BUILD_NUMBER % 5 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
fi;
[20/51] celix git commit: CELIX-339: add functionality to show
celix_log_mock log output
Posted by pn...@apache.org.
CELIX-339: add functionality to show celix_log_mock log output
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/099fc6b8
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/099fc6b8
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/099fc6b8
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 099fc6b8e9af8b0609ffaadbe1cc349116ad761e
Parents: 3b82dc8
Author: Bjoern Petri <bp...@apache.org>
Authored: Mon Jan 11 10:02:11 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Mon Jan 11 10:02:11 2016 +0100
----------------------------------------------------------------------
framework/private/mock/celix_log_mock.c | 54 ++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/099fc6b8/framework/private/mock/celix_log_mock.c
----------------------------------------------------------------------
diff --git a/framework/private/mock/celix_log_mock.c b/framework/private/mock/celix_log_mock.c
index 066077d..7904553 100644
--- a/framework/private/mock/celix_log_mock.c
+++ b/framework/private/mock/celix_log_mock.c
@@ -25,17 +25,71 @@
*/
#include "CppUTestExt/MockSupport_c.h"
+#include <stdarg.h>
+
+#include "celix_errno.h"
#include "celix_log.h"
+static void test_logger_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...);
+static void test_logger_print(framework_log_level_t level, const char *func, const char *file, int line, char *msg);
+
void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...) {
mock_c()->actualCall("framework_log");
+
+ test_logger_log(logger, level, func, file, line, "%s", fmsg);
}
void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...) {
mock_c()->actualCall("framework_logCode")->withIntParameters("code", code);
+ char message[256];
+ celix_strerror(code, message, 256);
+ char msg[512];
+ va_list listPointer;
+ va_start(listPointer, fmsg);
+ vsprintf(msg, fmsg, listPointer);
+
+ test_logger_log(logger, level, func, file, line, "%s [%d]: %s", message, code, msg);
}
celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, char *msg) {
mock_c()->actualCall("frameworkLogger_log");
+
+ test_logger_print(level, func, file, line, msg);
+
return mock_c()->returnValue().value.intValue;
}
+
+//test logger functions, let you read the logged errors
+static void test_logger_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...) {
+ char msg[512];
+ va_list listPointer;
+ va_start(listPointer, fmsg);
+ vsprintf(msg, fmsg, listPointer);
+
+ test_logger_print(level, func, file, line, msg);
+}
+
+static void test_logger_print(framework_log_level_t level, const char *func, const char *file, int line, 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("Code says: %s: %s\n\tat %s(%s:%d)\n", levelStr, msg, func, file, line);
+ } else {
+ printf("Code says: %s: %s\n", levelStr, msg);
+ }
+}
[03/51] celix git commit: Merge branch 'config_admin' into develop
Posted by pn...@apache.org.
Merge branch 'config_admin' into develop
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3779c353
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3779c353
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3779c353
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 3779c353d8be9de7fa828697ca328457017da14a
Parents: e9ed019 d3c9418
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Jan 6 15:33:33 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Jan 6 15:33:33 2016 +0100
----------------------------------------------------------------------
CMakeLists.txt | 1 +
config_admin/CMakeLists.txt | 25 +-
config_admin/config_admin_tst/CMakeLists.txt | 51 +++
.../config_admin_tst/config.properties.in | 20 +
.../config_admin_tst/config_admin_test.cpp | 404 +++++++++++++++++++
.../example_test/CMakeLists.txt | 32 ++
.../example_test/META-INF/MANIFEST.MF | 5 +
.../include/example_managed_service_impl.h | 67 +++
.../example_test/private/src/activator.c | 205 ++++++++++
.../private/src/example_managed_service_impl.c | 97 +++++
.../example_test2/CMakeLists.txt | 32 ++
.../example_test2/META-INF/MANIFEST.MF | 5 +
.../include/example2_managed_service_impl.h | 65 +++
.../example_test2/private/src/activator.c | 225 +++++++++++
.../private/src/example_managed_service_impl.c | 103 +++++
config_admin/examples/CMakeLists.txt | 21 -
.../examples/example_test/CMakeLists.txt | 32 --
.../examples/example_test/META-INF/MANIFEST.MF | 5 -
.../include/example_managed_service_impl.h | 53 ---
.../example_test/private/src/activator.c | 188 ---------
.../private/src/example_managed_service_impl.c | 94 -----
.../examples/example_test2/CMakeLists.txt | 21 -
.../bundle_configuring/CMakeLists.txt | 30 --
.../bundle_configuring/META-INF/MANIFEST.MF | 5 -
.../bundle_configuring/private/src/activator.c | 94 -----
.../bundle_managed_service/CMakeLists.txt | 32 --
.../bundle_managed_service/META-INF/MANIFEST.MF | 5 -
.../include/example_managed_service_impl.h | 55 ---
.../private/src/activator.c | 120 ------
.../private/src/example_managed_service_impl.c | 95 -----
config_admin/readme.md | 29 ++
.../include/configuration_admin_factory.h | 2 +-
.../private/include/configuration_impl.h | 36 +-
.../private/include/configuration_store.h | 1 +
.../private/include/managed_service_tracker.h | 9 +-
.../private/include/updated_thread_pool.h | 8 +-
config_admin/service/private/src/activator.c | 10 +-
.../private/src/configuration_admin_factory.c | 25 +-
.../private/src/configuration_admin_impl.c | 13 +-
.../service/private/src/configuration_impl.c | 313 ++++++++------
.../service/private/src/configuration_store.c | 78 ++--
.../service/private/src/managed_service_impl.c | 5 +
.../private/src/managed_service_tracker.c | 166 ++++----
.../service/private/src/updated_thread_pool.c | 41 +-
.../service/public/include/configuration.h | 27 +-
.../service/public/include/managed_service.h | 2 +-
dfi/CMakeLists.txt | 2 +-
framework/private/src/service_registry.c | 4 +-
48 files changed, 1795 insertions(+), 1163 deletions(-)
----------------------------------------------------------------------
[44/51] celix git commit: CELIX-247: Adapt cmake configuration to
allow android compilation
Posted by pn...@apache.org.
CELIX-247: Adapt cmake configuration to allow android compilation
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/41287a35
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/41287a35
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/41287a35
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 41287a355c19bb10bafd2c13aede4383fff64d99
Parents: 38fd461
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 22 20:32:39 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 22 20:32:39 2016 +0100
----------------------------------------------------------------------
CMakeLists.txt | 2 +-
dfi/CMakeLists.txt | 2 +-
utils/CMakeLists.txt | 6 ++++--
3 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/41287a35/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 375568c..69d3a91 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,7 +37,7 @@ IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 3.3 AND ${CMAKE_GENERATO
message( FATAL_ERROR "Building Celix using CMake 3.3 and makefiles is not supported due to a bug in the Makefile Generator (see Bug 15696). Please change the used CMake version - both, CMake 3.2 and CMake 3.4 are working fine. Or use a different generator (e.g. Ninja)." )
ENDIF()
-IF(UNIX)
+IF(UNIX AND NOT ANDROID)
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror ${CMAKE_C_FLAGS}")
#SET(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
ENDIF()
http://git-wip-us.apache.org/repos/asf/celix/blob/41287a35/dfi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dfi/CMakeLists.txt b/dfi/CMakeLists.txt
index 43511fe..a783b32 100644
--- a/dfi/CMakeLists.txt
+++ b/dfi/CMakeLists.txt
@@ -28,7 +28,7 @@ include_directories(
set(MEMSTREAM_SOURCES )
set(MEMSTREAM_INCLUDES )
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ANDROID)
set(MEMSTREAM_SOURCES private/src/memstream/open_memstream.c private/src/memstream/fmemopen.c)
set(MEMSTREAM_INCLUDES public/include/memstream/open_memstream.h public/include/memstream/fmemopen.h)
include_directories(public/include/memstream)
http://git-wip-us.apache.org/repos/asf/celix/blob/41287a35/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index bdf584d..77b1aa2 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -55,9 +55,11 @@ if (UTILS)
public/include/thpool.h
)
- IF(UNIX)
+ IF(UNIX AND NOT ANDROID)
target_link_libraries(celix_utils m pthread)
- ENDIF(UNIX)
+ ELSEIF(ANDROID)
+ target_link_libraries(celix_utils m)
+ ENDIF()
install(TARGETS celix_utils DESTINATION lib COMPONENT framework)
FILE(GLOB files "public/include/*.h")
[09/51] celix git commit: CELIX-246: Add additional job using
linux/gcc/address sanitizer
Posted by pn...@apache.org.
CELIX-246: Add additional job using linux/gcc/address sanitizer
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/613cd7fe
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/613cd7fe
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/613cd7fe
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 613cd7fed7c3b3f5c6b57d7c49f365e1cfdcc59f
Parents: 876654f
Author: Bjoern Petri <bp...@apache.org>
Authored: Thu Jan 7 15:52:52 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Thu Jan 7 15:52:52 2016 +0100
----------------------------------------------------------------------
.travis.yml | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/613cd7fe/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 8855894..75c2440 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,8 +8,14 @@ compiler:
- gcc
- clang
+matrix:
+ include:
+ - os: linux
+ compiler: gcc
+ env: SANITIZE=1
+
before_install:
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -qq update && sudo apt-get install -y uuid-dev libxml2-dev lcov libffi-dev; fi
+ - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get -qq update && sudo apt-get install -y uuid-dev libxml2-dev lcov libffi-dev gcc-4.8 g++-4.8; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update && brew install lcov libffi && brew link --force libffi; fi
before_script:
@@ -26,6 +32,7 @@ before_script:
script:
+ - if [ "$SANITIZE" == 1 ]; then export CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 CFLAGS="-lasan -fsanitize=address" CXXFLAGS="-lasan -fsanitize=address" ASAN_OPTIONS="symbolize=1" ASAN_SYMBOLIZER_PATH="/usr/bin/asan_symbolize"; fi
# the following setup is broken:
# RSA_DISCOVERY_SHM is only working on linux, but both compilers (see CELIX-277)
# RSA_SHM is only working on linux, but both compilers (see CELIX-277)
[15/51] celix git commit: CELIX-330: re-enable build restriction for
coverity
Posted by pn...@apache.org.
CELIX-330: re-enable build restriction for coverity
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/6a4d86aa
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/6a4d86aa
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/6a4d86aa
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 6a4d86aafa1da731fdad7001b1de6f7aa7cd979f
Parents: 2802d46
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 8 10:13:25 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 8 10:13:25 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/6a4d86aa/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 62d3a8d..ffe8c98 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -60,5 +60,5 @@ after_success:
gem install coveralls-lcov &&
make coverage &&
lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx && coveralls-lcov --repo-token=9dpeTAjiGoQU5hgXFe0ezk65iu40oc3WY coverage.info;
- if [ $(( $TRAVIS_BUILD_NUMBER % 1 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
+ if [ $(( $TRAVIS_BUILD_NUMBER % 10 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
fi;
[42/51] celix git commit: CELIX-341: fix possible dereferencing error
Posted by pn...@apache.org.
CELIX-341: fix possible dereferencing error
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/fa4ee3c2
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/fa4ee3c2
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/fa4ee3c2
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: fa4ee3c2a89711f83a7b6671bf577c5945ae8684
Parents: 79235f0
Author: Bjoern Petri <bp...@apache.org>
Authored: Wed Jan 20 18:25:04 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Wed Jan 20 18:25:04 2016 +0100
----------------------------------------------------------------------
shell/private/src/shell.c | 126 +++++++++++++++++++++--------------------
1 file changed, 64 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/fa4ee3c2/shell/private/src/shell.c
----------------------------------------------------------------------
diff --git a/shell/private/src/shell.c b/shell/private/src/shell.c
index fc673bd..c48c265 100644
--- a/shell/private/src/shell.c
+++ b/shell/private/src/shell.c
@@ -108,78 +108,80 @@ celix_status_t shell_destroy(shell_service_pt *shell_service_ptr) {
}
celix_status_t shell_addCommand(shell_pt shell_ptr, service_reference_pt reference_ptr) {
- celix_status_t status = CELIX_SUCCESS;
- command_service_pt command_ptr = NULL;
- char *name_str = NULL;
-
- if (!shell_ptr && !reference_ptr) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- status = bundleContext_getService(shell_ptr->bundle_context_ptr, reference_ptr, (void **) &command_ptr);
- if (!command_ptr) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = serviceReference_getProperty(reference_ptr, "command.name", &name_str);
- if (!name_str) {
+ celix_status_t status = CELIX_SUCCESS;
+ command_service_pt command_ptr = NULL;
+ char *name_str = NULL;
+
+ if (!shell_ptr || !reference_ptr) {
+ status = CELIX_ILLEGAL_ARGUMENT;
+ }
+
+ if (status == CELIX_SUCCESS) {
+ status = bundleContext_getService(shell_ptr->bundle_context_ptr, reference_ptr, (void **) &command_ptr);
+ if (!command_ptr) {
+ status = CELIX_BUNDLE_EXCEPTION;
+ }
+ }
+
+ if (status == CELIX_SUCCESS) {
+ status = serviceReference_getProperty(reference_ptr, "command.name", &name_str);
+ if (!name_str) {
logHelper_log(shell_ptr->logHelper, OSGI_LOGSERVICE_ERROR, "Command service must contain a 'command.name' property!");
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
+ status = CELIX_BUNDLE_EXCEPTION;
+ }
+ }
- if (status == CELIX_SUCCESS) {
- hashMap_put(shell_ptr->command_name_map_ptr, name_str, command_ptr);
- hashMap_put(shell_ptr->command_reference_map_ptr, reference_ptr, command_ptr);
- }
+ if (status == CELIX_SUCCESS) {
+ hashMap_put(shell_ptr->command_name_map_ptr, name_str, command_ptr);
+ hashMap_put(shell_ptr->command_reference_map_ptr, reference_ptr, command_ptr);
+ }
- if (status != CELIX_SUCCESS) {
- shell_removeCommand(shell_ptr, reference_ptr);
+ if (status != CELIX_SUCCESS) {
+ shell_removeCommand(shell_ptr, reference_ptr);
char err[32];
celix_strerror(status, err, 32);
logHelper_log(shell_ptr->logHelper, OSGI_LOGSERVICE_ERROR, "Could not add command, got error %s\n", err);
- }
+ }
- return status;
+ return status;
}
celix_status_t shell_removeCommand(shell_pt shell_ptr, service_reference_pt reference_ptr) {
- celix_status_t status = CELIX_SUCCESS;
-
- command_service_pt command_ptr = NULL;
- char *name_str = NULL;
-
- if (!shell_ptr || !reference_ptr) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- command_ptr = hashMap_remove(shell_ptr->command_reference_map_ptr, reference_ptr);
- if (!command_ptr) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = serviceReference_getProperty(reference_ptr, "command.name", &name_str);
- if (!name_str) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- hashMap_remove(shell_ptr->command_name_map_ptr, name_str);
- }
-
- celix_status_t sub_status = bundleContext_ungetService(shell_ptr->bundle_context_ptr, reference_ptr, NULL);
- if (sub_status != CELIX_SUCCESS && status == CELIX_SUCCESS) {
- status = sub_status;
- }
-
- return status;
+ celix_status_t status = CELIX_SUCCESS;
+
+ command_service_pt command_ptr = NULL;
+ char *name_str = NULL;
+
+ if (!shell_ptr || !reference_ptr) {
+ status = CELIX_ILLEGAL_ARGUMENT;
+ }
+
+ if (status == CELIX_SUCCESS) {
+ command_ptr = hashMap_remove(shell_ptr->command_reference_map_ptr, reference_ptr);
+ if (!command_ptr) {
+ status = CELIX_ILLEGAL_ARGUMENT;
+ }
+ }
+
+ if (status == CELIX_SUCCESS) {
+ status = serviceReference_getProperty(reference_ptr, "command.name", &name_str);
+ if (!name_str) {
+ status = CELIX_BUNDLE_EXCEPTION;
+ }
+ }
+
+ if (status == CELIX_SUCCESS) {
+ hashMap_remove(shell_ptr->command_name_map_ptr, name_str);
+ }
+
+ if (status == CELIX_SUCCESS) {
+ celix_status_t sub_status = bundleContext_ungetService(shell_ptr->bundle_context_ptr, reference_ptr, NULL);
+ if (sub_status != CELIX_SUCCESS && status == CELIX_SUCCESS) {
+ status = sub_status;
+ }
+ }
+
+ return status;
}
celix_status_t shell_getCommands(shell_pt shell_ptr, array_list_pt *commands_ptr) {
[07/51] celix git commit: CELIX-77: Disable config_admin building in
travis. not stable enough
Posted by pn...@apache.org.
CELIX-77: Disable config_admin building in travis. not stable enough
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/a01de9e9
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/a01de9e9
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/a01de9e9
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: a01de9e9d58609c6909d1d84abb3e0377b7cbc08
Parents: dfafb46
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Jan 7 12:26:30 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 7 12:26:30 2016 +0100
----------------------------------------------------------------------
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/a01de9e9/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 27cc4f6..8855894 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,8 +31,8 @@ script:
# RSA_SHM is only working on linux, but both compilers (see CELIX-277)
- cd build
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export BUILD_OPTS="${BUILD_OPTS} -DENABLE_CODE_COVERAGE=ON"; fi
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake -DBUILD_CONFIG_ADMIN=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_DEPENDENCY_MANAGER=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake -DBUILD_CONFIG_ADMIN=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_DEPENDENCY_MANAGER=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=OFF -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=OFF -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
+ - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_DEPENDENCY_MANAGER=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
+ - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_DEPENDENCY_MANAGER=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=OFF -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=OFF -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- make all && make deploy && make install-all
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"
[35/51] celix git commit: CELIX-77: fixed some more memory issues
Posted by pn...@apache.org.
CELIX-77: fixed some more memory issues
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/10e5b896
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/10e5b896
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/10e5b896
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 10e5b896945ab723aff37d0ea2a26149c00894e5
Parents: 7d10d6e
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 15 11:20:38 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 15 11:20:38 2016 +0100
----------------------------------------------------------------------
config_admin/config_admin_tst/CMakeLists.txt | 4 ----
config_admin/config_admin_tst/config_admin_test.cpp | 8 ++------
.../service/private/include/configuration_admin_impl.h | 1 +
.../service/private/src/configuration_admin_factory.c | 10 ++++++----
.../service/private/src/configuration_admin_impl.c | 8 ++++++--
config_admin/service/private/src/configuration_store.c | 3 +++
6 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/10e5b896/config_admin/config_admin_tst/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/CMakeLists.txt b/config_admin/config_admin_tst/CMakeLists.txt
index ee2e2ec..bc20862 100644
--- a/config_admin/config_admin_tst/CMakeLists.txt
+++ b/config_admin/config_admin_tst/CMakeLists.txt
@@ -40,10 +40,6 @@ get_property(example_test_bundle_file TARGET example_test PROPERTY BUNDLE)
get_property(example_test2_bundle_file TARGET example_test2 PROPERTY BUNDLE)
configure_file(config.properties.in config.properties @ONLY)
-#configure_file(client.properties.in client.properties @ONLY)
-#configure_file(server.properties.in server.properties @ONLY)
-
-#add_dependencies(test_rsa_dfi remote_service_admin_dfi calculator)
#ADD_TARGET_FOR_TEST(config_admin_test)
http://git-wip-us.apache.org/repos/asf/celix/blob/10e5b896/config_admin/config_admin_tst/config_admin_test.cpp
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config_admin_test.cpp b/config_admin/config_admin_tst/config_admin_test.cpp
index f75cc3a..8539c76 100644
--- a/config_admin/config_admin_tst/config_admin_test.cpp
+++ b/config_admin/config_admin_tst/config_admin_test.cpp
@@ -84,8 +84,9 @@ tst2_service_pt test2Serv = NULL;
rc = bundleContext_getServiceReference(context, (char *) TST2_SERVICE_NAME, &test2Ref);
CHECK_EQUAL(CELIX_SUCCESS, rc);
- rc = bundleContext_getService(context, testRef, (void **)&test2Serv);
+ rc = bundleContext_getService(context, test2Ref, (void **)&test2Serv);
CHECK_EQUAL(CELIX_SUCCESS, rc);
+
}
void teardownFw(void) {
@@ -94,10 +95,6 @@ tst2_service_pt test2Serv = NULL;
rc = bundleContext_ungetService(context, testRef, NULL);
CHECK_EQUAL(CELIX_SUCCESS, rc);
- // check whether this is necessary
- rc = bundleContext_ungetService(context, testRef, NULL);
- CHECK_EQUAL(CELIX_SUCCESS, rc);
-
rc = bundleContext_ungetServiceReference(context, testRef);
CHECK_EQUAL(CELIX_SUCCESS, rc);
@@ -405,4 +402,3 @@ TEST(managed_service, test_managed_service) {
TEST(managed_service, test_bundles) {
testBundles();
}
-
http://git-wip-us.apache.org/repos/asf/celix/blob/10e5b896/config_admin/service/private/include/configuration_admin_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_admin_impl.h b/config_admin/service/private/include/configuration_admin_impl.h
index be79602..b90a21d 100644
--- a/config_admin/service/private/include/configuration_admin_impl.h
+++ b/config_admin/service/private/include/configuration_admin_impl.h
@@ -52,6 +52,7 @@ struct configuration_admin{
/* METHODS: celix.config_admin.private */
celix_status_t configurationAdmin_create(configuration_admin_factory_pt factory, configuration_store_pt store, bundle_pt bundle,
configuration_admin_service_pt *service);
+celix_status_t configurationAdmin_destroy(configuration_admin_service_pt *service);
/* METHODS: celix.config_admin.public */
celix_status_t configurationAdmin_createFactoryConfiguration(configuration_admin_pt configAdmin, char *factoryPid, configuration_pt *configuration);
http://git-wip-us.apache.org/repos/asf/celix/blob/10e5b896/config_admin/service/private/src/configuration_admin_factory.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_factory.c b/config_admin/service/private/src/configuration_admin_factory.c
index 1c821ea..f8871d9 100644
--- a/config_admin/service/private/src/configuration_admin_factory.c
+++ b/config_admin/service/private/src/configuration_admin_factory.c
@@ -143,16 +143,18 @@ celix_status_t configurationAdminFactory_getService(void *handle, bundle_pt bund
* END DEBUG CODE */
(*service) = confAdminService;
+
return CELIX_SUCCESS;
}
-celix_status_t configurationAdminFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service){
- // do nothing
+celix_status_t configurationAdminFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service) {
- free(*service);
+ configuration_admin_service_pt confAdminService = (*service);
- return CELIX_SUCCESS;
+ configurationAdmin_destroy(&confAdminService);
+
+ return CELIX_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/10e5b896/config_admin/service/private/src/configuration_admin_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_impl.c b/config_admin/service/private/src/configuration_admin_impl.c
index eb8cb06..e88e191 100644
--- a/config_admin/service/private/src/configuration_admin_impl.c
+++ b/config_admin/service/private/src/configuration_admin_impl.c
@@ -49,6 +49,8 @@ celix_status_t configurationAdmin_create(configuration_admin_factory_pt factory,
configuration_admin_service_pt *service){
*service = calloc(1, sizeof(**service));
+
+
if(!*service){
printf("[ ERROR ]: ConfigAdmin - Not initialized(ENOMEM) \n");
return CELIX_ENOMEM;
@@ -77,8 +79,10 @@ celix_status_t configurationAdmin_create(configuration_admin_factory_pt factory,
}
celix_status_t configurationAdmin_destroy(configuration_admin_service_pt *service) {
- free(service);
- return CELIX_SUCCESS;
+ free((*service)->configAdmin);
+ free(*service);
+
+ return CELIX_SUCCESS;
}
/* ========== IMPLEMENTATION ========== */
http://git-wip-us.apache.org/repos/asf/celix/blob/10e5b896/config_admin/service/private/src/configuration_store.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_store.c b/config_admin/service/private/src/configuration_store.c
index cee51e5..19a416d 100644
--- a/config_admin/service/private/src/configuration_store.c
+++ b/config_admin/service/private/src/configuration_store.c
@@ -109,6 +109,9 @@ celix_status_t configurationStore_create(bundle_context_pt context, configuratio
celix_status_t configurationStore_destroy(configuration_store_pt store) {
celixThreadMutex_destroy(&store->mutex);
+ hashMap_destroy(store->configurations, true, true);
+ free(store);
+
return CELIX_SUCCESS;
}
[46/51] celix git commit: CELIX-247: Adapted comment
Posted by pn...@apache.org.
CELIX-247: Adapted comment
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/25f6497d
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/25f6497d
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/25f6497d
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 25f6497d047be1f9a72c93f1a506503e874176d1
Parents: 1df20ee
Author: Bjoern Petri <bp...@apache.org>
Authored: Sat Jan 23 18:22:59 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sat Jan 23 18:22:59 2016 +0100
----------------------------------------------------------------------
Dockerfile.Android | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/25f6497d/Dockerfile.Android
----------------------------------------------------------------------
diff --git a/Dockerfile.Android b/Dockerfile.Android
index 52cafd2..52ad785 100644
--- a/Dockerfile.Android
+++ b/Dockerfile.Android
@@ -5,7 +5,8 @@
# Celix android builder
#
# Howto:
-# Build docker image -> docker build -t celix-android-builder <path-to-this-dockerfile>
+#
+# Build docker image -> docker build -t celix-android-builder - < Dockerfile.Android
# Run docker image -> docker run --name builder celix-android-builder
# Extract filesystem -> docker export builder > fs.tar
# Extract /build dir from tar -> tar xf fs.tar build/output/celix
[18/51] celix git commit: CELIX-336: resolver_test doesn't compile
Posted by pn...@apache.org.
CELIX-336: resolver_test doesn't compile
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/52daddd7
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/52daddd7
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/52daddd7
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 52daddd733c39ec4c7afe7846513486b074295c7
Parents: 8352b23
Author: Bjoern Petri <bp...@apache.org>
Authored: Mon Jan 11 09:53:43 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Mon Jan 11 09:53:43 2016 +0100
----------------------------------------------------------------------
framework/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/52daddd7/framework/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index 9d90e8a..e989032 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -93,6 +93,7 @@ if (FRAMEWORK)
include_directories(${CPPUTEST_INCLUDE_DIR})
include_directories(${CPPUTEST_EXT_INCLUDE_DIR})
+ include_directories(${PROJECT_SOURCE_DIR}/utils/private/include)
add_executable(attribute_test
private/test/attribute_test.cpp
[04/51] celix git commit: CELIX-77: Remove warning in cpp (unit test)
sources.
Posted by pn...@apache.org.
CELIX-77: Remove warning in cpp (unit test) sources.
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/f71246c1
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/f71246c1
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/f71246c1
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: f71246c115740cc3a39c618122af9713e928b8a3
Parents: 3779c35
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Jan 6 15:39:21 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Jan 6 15:39:21 2016 +0100
----------------------------------------------------------------------
remote_services/topology_manager/tms_tst/tms_tests.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/f71246c1/remote_services/topology_manager/tms_tst/tms_tests.cpp
----------------------------------------------------------------------
diff --git a/remote_services/topology_manager/tms_tst/tms_tests.cpp b/remote_services/topology_manager/tms_tst/tms_tests.cpp
index 4257a01..d6b05b7 100644
--- a/remote_services/topology_manager/tms_tst/tms_tests.cpp
+++ b/remote_services/topology_manager/tms_tst/tms_tests.cpp
@@ -466,6 +466,7 @@ extern "C" {
/// \TEST_CASE_TITLE{Test scope initialisation}
/// \TEST_CASE_REQ{REQ-5}
/// \TEST_CASE_DESC Invalid input file, two partly matching filters with same key name
+ /*
static void testScope4(void) {
int nr_exported;
int nr_imported;
@@ -485,7 +486,7 @@ extern "C" {
CHECK_TRUE((entry == NULL));
}
printf("End: %s\n", __func__);
- }
+ }*/
/// \TEST_CASE_ID{6}
[50/51] celix git commit: CELIX-237: Add Cmake flags for android
build, fix Dockerfile
Posted by pn...@apache.org.
CELIX-237: Add Cmake flags for android build, fix Dockerfile
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/2eac60ef
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/2eac60ef
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/2eac60ef
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 2eac60ef074fd8d42fd1095fc1ea9e4e2b4af3c5
Parents: 4ada010
Author: Bjoern Petri <bp...@apache.org>
Authored: Mon Jan 25 10:34:11 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Mon Jan 25 10:34:11 2016 +0100
----------------------------------------------------------------------
CMakeLists.txt | 3 +++
Dockerfile.Android | 4 +---
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/2eac60ef/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69d3a91..19096b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,9 @@ IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 3.3 AND ${CMAKE_GENERATO
message( FATAL_ERROR "Building Celix using CMake 3.3 and makefiles is not supported due to a bug in the Makefile Generator (see Bug 15696). Please change the used CMake version - both, CMake 3.2 and CMake 3.4 are working fine. Or use a different generator (e.g. Ninja)." )
ENDIF()
+IF (ANDROID)
+ SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall ${CMAKE_C_FLAGS}")
+ENDIF()
IF(UNIX AND NOT ANDROID)
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror ${CMAKE_C_FLAGS}")
#SET(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
http://git-wip-us.apache.org/repos/asf/celix/blob/2eac60ef/Dockerfile.Android
----------------------------------------------------------------------
diff --git a/Dockerfile.Android b/Dockerfile.Android
index 52ad785..6960ce7 100644
--- a/Dockerfile.Android
+++ b/Dockerfile.Android
@@ -112,10 +112,8 @@ RUN curl -L -O ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz && \
# finally add celix src
-ADD . celix
-#Or do git clone -> RUN git clone https://github.com/apache/celix.git celix
+RUN git clone -b develop --single-branch https://github.com/apache/celix.git celix
CMD mkdir -p celix/build-android && cd celix/build-android && cmake -DANDROID=TRUE -DENABLE_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=OFF -DBUILD_RSA_TOPOLOGY_MANAGER=ON -DFFI_LIBRARY=/build/output/libffi/lib/libffi.a -DFFI_INCLUDE_DIR=/build/output/libffi/lib/libffi-3.2.1/include -DJANSSON_LIBRARY=/build/output/jansson/lib/libjansson.a -DJANSSON_INCLUDE_DIR=/build/output/jansson/include -DCURL_LIBRARY=/build/output/curl/lib/libcurl.a -DCURL_INCLUDE_DIR=/build/output/curl/include -DLIBXML2_LIBRARIES=/build/output/libxml2/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/build/output/libxml2/include/libxml2 -DZLIB_LIBRARY=/build/output/zlib/lib/libz.a -DZLIB_INCLUDE_DIR=/build/output/zlib/include -DUUID_LIBRARY=/build/output/uuid/lib/libuuid.a -DUUID_INCLUDE_DIR=/build/output/uuid/incl
ude -DCMAKE_INSTALL_PREFIX:PATH=/build/output/celix .. && make && make install-all
# done
-
[43/51] celix git commit: CELIX-341: fix possible dereferencing error
Posted by pn...@apache.org.
CELIX-341: fix possible dereferencing error
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/38fd4611
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/38fd4611
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/38fd4611
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 38fd461116e545847924c44983c7a1cc8e440c77
Parents: fa4ee3c
Author: Bjoern Petri <bp...@apache.org>
Authored: Wed Jan 20 18:31:39 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Wed Jan 20 18:31:39 2016 +0100
----------------------------------------------------------------------
shell/private/src/activator.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/38fd4611/shell/private/src/activator.c
----------------------------------------------------------------------
diff --git a/shell/private/src/activator.c b/shell/private/src/activator.c
index edd2931..69f656f 100644
--- a/shell/private/src/activator.c
+++ b/shell/private/src/activator.c
@@ -237,10 +237,10 @@ celix_status_t bundleActivator_start(void *_ptr, bundle_context_pt context_ptr)
}
celix_status_t bundleActivator_stop(void *_ptr, bundle_context_pt context_ptr) {
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status = CELIX_SUCCESS;
celix_status_t sub_status;
- bundle_instance_pt instance_ptr = (bundle_instance_pt) _ptr;
+ bundle_instance_pt instance_ptr = (bundle_instance_pt) _ptr;
if (instance_ptr) {
for (unsigned int i = 0; instance_ptr->std_commands[i].exec != NULL; i++) {
@@ -250,32 +250,36 @@ celix_status_t bundleActivator_stop(void *_ptr, bundle_context_pt context_ptr) {
instance_ptr->std_commands[i].props = NULL;
}
}
- }
- sub_status = bundleContext_removeServiceListener(context_ptr, instance_ptr->listener);
- if (status == CELIX_SUCCESS && sub_status != CELIX_SUCCESS) {
- status = sub_status;
+ sub_status = bundleContext_removeServiceListener(context_ptr, instance_ptr->listener);
+ if (status == CELIX_SUCCESS && sub_status != CELIX_SUCCESS) {
+ status = sub_status;
+ }
+ } else {
+ status = CELIX_ILLEGAL_ARGUMENT;
}
- return status;
+ return status;
}
celix_status_t bundleActivator_destroy(void *_ptr, bundle_context_pt __attribute__((__unused__)) context_ptr) {
+ celix_status_t status = CELIX_SUCCESS;
+
bundle_instance_pt instance_ptr = (bundle_instance_pt) _ptr;
if (instance_ptr) {
for (unsigned int i = 0; instance_ptr->std_commands[i].exec != NULL; i++) {
free(instance_ptr->std_commands[i].service);
}
- }
-
- serviceRegistration_unregister(instance_ptr->registration);
- shell_destroy(&instance_ptr->shellService);
+ serviceRegistration_unregister(instance_ptr->registration);
+ shell_destroy(&instance_ptr->shellService);
- free(instance_ptr->listener);
-
- free(instance_ptr);
+ free(instance_ptr->listener);
+ free(instance_ptr);
+ } else {
+ status = CELIX_ILLEGAL_ARGUMENT;
+ }
- return CELIX_SUCCESS;
+ return status;
}
[41/51] celix git commit: CELIX-341: add missing return value check
Posted by pn...@apache.org.
CELIX-341: add missing return value check
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/79235f0c
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/79235f0c
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/79235f0c
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 79235f0cd87dc948d8aaa21c7d03e30ed6cf1b30
Parents: 5403908
Author: Bjoern Petri <bp...@apache.org>
Authored: Sat Jan 16 11:14:58 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sat Jan 16 11:14:58 2016 +0100
----------------------------------------------------------------------
shell/private/src/log_command.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/79235f0c/shell/private/src/log_command.c
----------------------------------------------------------------------
diff --git a/shell/private/src/log_command.c b/shell/private/src/log_command.c
index a1f77c1..8b0244a 100644
--- a/shell/private/src/log_command.c
+++ b/shell/private/src/log_command.c
@@ -34,10 +34,11 @@
celix_status_t logCommand_levelAsString(bundle_context_pt context, log_level_t level, char **string);
void logCommand_execute(bundle_context_pt context, char *line, FILE *outStream, FILE *errStream) {
+ celix_status_t status;
service_reference_pt readerService = NULL;
- bundleContext_getServiceReference(context, (char *) OSGI_LOGSERVICE_READER_SERVICE_NAME, &readerService);
- if (readerService != NULL) {
+ status = bundleContext_getServiceReference(context, (char *) OSGI_LOGSERVICE_READER_SERVICE_NAME, &readerService);
+ if (status != CELIX_SUCCESS || readerService != NULL) {
linked_list_pt list = NULL;
linked_list_iterator_pt iter = NULL;
log_reader_service_pt reader = NULL;
[30/51] celix git commit: CELIX-77: Fix in travis.yml. Seperated some
options for osx & linux
Posted by pn...@apache.org.
CELIX-77: Fix in travis.yml. Seperated some options for osx & linux
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/9c7973f0
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/9c7973f0
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/9c7973f0
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 9c7973f06dac5d03abfa109c2c26325b5e0b762f
Parents: df91e19
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Jan 14 11:31:57 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 14 11:31:57 2016 +0100
----------------------------------------------------------------------
.travis.yml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/9c7973f0/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index fca6b4e..cb3745f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -50,14 +50,18 @@ before_script:
-DBUILD_REMOTE_SERVICE_ADMIN=ON \
-DBUILD_RSA_DISCOVERY_CONFIGURED=ON \
-DBUILD_RSA_DISCOVERY_ETCD=ON \
- -DBUILD_RSA_DISCOVERY_SHM=ON \
-DBUILD_RSA_EXAMPLES=ON \
- -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON \
-DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON \
- -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON \
+ -DBUILD_REMOTE_SHELL=ON \
+ -DBUILD_SHELL=ON \
-DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON \
-DBUILD_DEVICE_ACCESS_EXAMPLE=ON "
-
+ - export BUILD_OPTIONS_LINUX=" \
+ -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON \
+ -DBUILD_RSA_DISCOVERY_SHM=ON "
+ - export BUILD_OPTIONS_OSX=" \
+ -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=OFF \
+ -DBUILD_RSA_DISCOVERY_SHM=OFF "
script:
- if [ "$SANITIZE" == 1 ]; then export CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 CFLAGS="-lasan -fsanitize=address" CXXFLAGS="-lasan -fsanitize=address" ASAN_OPTIONS="symbolize=1" ASAN_SYMBOLIZER_PATH="/usr/local/clang-3.4/bin/llvm-symbolizer"; fi
[28/51] celix git commit: CELIX-77: Enable config_admin. Refactor
travis.yml to that the enabled subproject are more clearly stated in
seperated lines
Posted by pn...@apache.org.
CELIX-77: Enable config_admin. Refactor travis.yml to that the enabled subproject are more clearly stated in seperated lines
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/fb8bef53
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/fb8bef53
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/fb8bef53
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: fb8bef5326f3a51a433e2873c30150c592e4aa0d
Parents: 3605d26
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Jan 14 11:17:28 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 14 11:17:28 2016 +0100
----------------------------------------------------------------------
.travis.yml | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/fb8bef53/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 55eab3e..e2308b0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -40,6 +40,24 @@ before_script:
- sudo make install
- cd -
- mkdir build install
+ - export BUILD_OPTIONS=" \
+ -DBUILD_CONFIG_ADMIN=ON \
+ -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON \
+ -DBUILD_DEPLOYMENT_ADMIN=ON \
+ -DBUILD_DEPENDENCY_MANAGER=ON \
+ -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON \
+ -DBUILD_LOG_WRITER=ON \
+ -DBUILD_REMOTE_SERVICE_ADMIN=ON \
+ -DBUILD_RSA_DISCOVERY_CONFIGURED=ON \
+ -DBUILD_RSA_DISCOVERY_ETCD=ON \
+ -DBUILD_RSA_DISCOVERY_SHM=ON \
+ -DBUILD_RSA_EXAMPLES=ON \
+ -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON \
+ -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON \
+ -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON \
+ -DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON \
+ -DBUILD_DEVICE_ACCESS_EXAMPLE=ON \
+ "
script:
@@ -49,8 +67,8 @@ script:
# RSA_SHM is only working on linux, but both compilers (see CELIX-277)
- cd build
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export BUILD_OPTS="${BUILD_OPTS} -DENABLE_CODE_COVERAGE=ON"; fi
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_DEPENDENCY_MANAGER=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_DEPENDENCY_MANAGER=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_DISCOVERY_SHM=OFF -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=OFF -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
+ - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ${BUILD_OPTIONS} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
+ - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake ${BUILD_OPTIONS} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- make all && make deploy && make install-all
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"
[13/51] celix git commit: CELIX-330: Restrict amount of coverity
builds
Posted by pn...@apache.org.
CELIX-330: Restrict amount of coverity builds
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/cfcb852c
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/cfcb852c
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/cfcb852c
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: cfcb852c72c782c9e3e201624ab0b6897af67394
Parents: b218a6b
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 8 06:52:56 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 8 06:52:56 2016 +0100
----------------------------------------------------------------------
.travis.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/cfcb852c/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 8cdf650..062414d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -60,6 +60,5 @@ after_success:
gem install coveralls-lcov &&
make coverage &&
lcx="lcov --output-file=coverage.info " && for i in `find . -name "*.info.cleaned"`; do lcx+=" --add-tracefile=$i"; done && $lcx && coveralls-lcov --repo-token=9dpeTAjiGoQU5hgXFe0ezk65iu40oc3WY coverage.info;
- make clean && eval "$COVERITY_SCAN_BUILD"
- #if [ $(( $TRAVIS_BUILD_NUMBER % 10 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
+ if [ $(( $TRAVIS_BUILD_NUMBER % 5 )) -eq 0 ]; then make clean & eval "$COVERITY_SCAN_BUILD"; fi
fi;
[16/51] celix git commit: CELIX-330: add README,
describing topology manager
Posted by pn...@apache.org.
CELIX-330: add README, describing topology manager
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/fe8d6b1e
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/fe8d6b1e
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/fe8d6b1e
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: fe8d6b1e46ed666d12ae76d575031b27c7e4cdf6
Parents: 6a4d86a
Author: Bjoern Petri <bp...@apache.org>
Authored: Sat Jan 9 13:25:44 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sat Jan 9 13:25:44 2016 +0100
----------------------------------------------------------------------
remote_services/topology_manager/README.md | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/fe8d6b1e/remote_services/topology_manager/README.md
----------------------------------------------------------------------
diff --git a/remote_services/topology_manager/README.md b/remote_services/topology_manager/README.md
new file mode 100644
index 0000000..e97c9e3
--- /dev/null
+++ b/remote_services/topology_manager/README.md
@@ -0,0 +1,6 @@
+## Topology Manager
+
+The Topology Manager decides which services should be imported and exported according to a defined policy. Currently, only one policy is implemented in Celix, the *promiscuous* policy, which simply imports and exports all services. Note that the Topology Manager is essential to use remote services.
+
+###### CMake option
+ BUILD_RSA_TOPOLOGY_MANAGER=ON
[22/51] celix git commit: CELIX-332: fix cmake config for filter_test
Posted by pn...@apache.org.
CELIX-332: fix cmake config for filter_test
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/e06e14ab
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/e06e14ab
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/e06e14ab
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: e06e14abf4c5325332543906950f9cd8fa087181
Parents: 9665049
Author: Bjoern Petri <bp...@apache.org>
Authored: Tue Jan 12 15:38:10 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Tue Jan 12 15:38:10 2016 +0100
----------------------------------------------------------------------
framework/CMakeLists.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/e06e14ab/framework/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index e989032..c6397dc 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -176,7 +176,8 @@ if (FRAMEWORK)
add_executable(filter_test
private/test/filter_test.cpp
- private/mock/properties_mock.c
+ private/src/utils.c
+ private/src/properties.c
private/src/filter.c
private/src/celix_errorcodes.c
private/mock/celix_log_mock.c)
[49/51] celix git commit: CELIX-247: adapt build path for android
build
Posted by pn...@apache.org.
CELIX-247: adapt build path for android build
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/4ada0107
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/4ada0107
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/4ada0107
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 4ada0107ab15fa2e6162c14ca8e2f7695eedf3eb
Parents: 264be18
Author: Bjoern Petri <bp...@apache.org>
Authored: Mon Jan 25 09:36:54 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Mon Jan 25 09:36:54 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/4ada0107/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 5ed0841..5ff6b65 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -83,7 +83,7 @@ script:
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export BUILD_OPTS="${BUILD_OPTS} -DENABLE_CODE_COVERAGE=ON"; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ -z "$ANDROID" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_LINUX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_OSX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- - if [ -z "$ANDROID" ]; then make all && make deploy && make install-all; else docker build -t celixandroid - < ../Dockerfile.Android ; fi
+ - if [ -z "$ANDROID" ]; then make all && make deploy && make install-all; else cd .. && docker build -t celixandroid - < Dockerfile.Android ; fi
- if [ -z "$ANDROID" ]; then export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"; else docker run celixandroid; fi
after_success:
[36/51] celix git commit: CELIX-77: Trigger new build
Posted by pn...@apache.org.
CELIX-77: Trigger new build
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/118d236e
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/118d236e
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/118d236e
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 118d236ec5c0338bb84a92398e92a03a33d4dd1b
Parents: 10e5b89
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 15 12:16:09 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 15 12:16:09 2016 +0100
----------------------------------------------------------------------
.travis.yml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/118d236e/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 25fb546..c291ba7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,4 @@
+
language: c
os:
[45/51] celix git commit: CELIX-247: Add Dockerfile for Android,
can be built with 'docker build - < Dockerfile.Android'
Posted by pn...@apache.org.
CELIX-247: Add Dockerfile for Android, can be built with 'docker build - < Dockerfile.Android'
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/1df20eea
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/1df20eea
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/1df20eea
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 1df20eea4998d589c4417a228078fed20eda15c2
Parents: 41287a3
Author: Bjoern Petri <bp...@apache.org>
Authored: Sat Jan 23 18:20:45 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sat Jan 23 18:20:45 2016 +0100
----------------------------------------------------------------------
Dockerfile.Android | 120 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 120 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/1df20eea/Dockerfile.Android
----------------------------------------------------------------------
diff --git a/Dockerfile.Android b/Dockerfile.Android
new file mode 100644
index 0000000..52cafd2
--- /dev/null
+++ b/Dockerfile.Android
@@ -0,0 +1,120 @@
+#
+# Licensed under Apache License v2. See LICENSE for more information.
+#
+
+# Celix android builder
+#
+# Howto:
+# Build docker image -> docker build -t celix-android-builder <path-to-this-dockerfile>
+# Run docker image -> docker run --name builder celix-android-builder
+# Extract filesystem -> docker export builder > fs.tar
+# Extract /build dir from tar -> tar xf fs.tar build/output/celix
+#
+#
+
+FROM ubuntu:14.04
+MAINTAINER Bjoern Petri <bj...@sundevil.de>
+
+ENV ARCH armv7
+ENV PLATFORM android-18
+ENV ANDROID_STANDALONE_TOOLCHAIN /build/toolchain-arm
+ENV ANDROID_CMAKE_HOME /build/resources/android-cmake
+ENV SYSROOT $ANDROID_STANDALONE_TOOLCHAIN/sysroot
+ENV PATH $ANDROID_STANDALONE_TOOLCHAIN/bin:$ANDROID_STANDALONE_TOOLCHAIN/usr/local/bin:$PATH
+ENV PATH $PATH:/build/resources/android-ndk-r10e
+ENV CROSS_COMPILE arm-linux-androideabi
+ENV CC arm-linux-androideabi-gcc
+ENV CCX arm-linux-androideabi-g++
+ENV AR arm-linux-androideabi-ar
+ENV AS arm-linux-androideabi-as
+ENV LD arm-linux-androideabi-ld
+ENV RANLIB arm-linux-androideabi-ranlib
+ENV NM arm-linux-androideabi-nm
+ENV STRIP arm-linux-androideabi-strip
+ENV CHOST arm-linux-androideabi
+
+# install needed tools
+
+RUN apt-get update && apt-get install -y \
+ automake \
+ build-essential \
+ wget \
+ p7zip-full \
+ bash \
+ curl \
+ cmake \
+ git \
+ vim
+
+
+RUN mkdir -p build/output
+
+WORKDIR /build/resources
+
+
+# Extracting ndk/sdk
+# create standalone toolchain
+RUN curl -L -O http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin && \
+ chmod a+x android-ndk-r10e-linux-x86_64.bin && \
+ 7z x android-ndk-r10e-linux-x86_64.bin > /dev/null && \
+ bash android-ndk-r10e/build/tools/make-standalone-toolchain.sh --verbose --platform=$PLATFORM --install-dir=$ANDROID_STANDALONE_TOOLCHAIN --arch=arm --toolchain=arm-linux-androideabi-4.9 --system=linux-x86_64
+
+
+
+# uuid
+RUN curl -L -O http://downloads.sourceforge.net/libuuid/libuuid-1.0.3.tar.gz && \
+ tar -xvzf libuuid-1.0.3.tar.gz && \
+ cd libuuid-1.0.3 && \
+ ./configure --host=arm-linux-androideabi --disable-shared --enable-static --prefix=/build/output/uuid && \
+ make && make install
+
+
+# zlib
+RUN curl -L -O http://zlib.net/zlib-1.2.8.tar.gz && \
+ tar -xvzf zlib-1.2.8.tar.gz && \
+ cd zlib-1.2.8 && \
+ ./configure --prefix=/build/output/zlib && make && make install
+
+# curl
+RUN curl -L -O http://curl.haxx.se/download/curl-7.38.0.tar.gz && \
+ tar -xvzf curl-7.38.0.tar.gz && \
+ cd curl-7.38.0 && \
+ ./configure --host=arm-linux-androideabi --disable-shared --enable-static --disable-dependency-tracking --with-zlib=`pwd`/../../output/zlib --without-ca-bundle --without-ca-path --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-sspi --disable-manual --target=arm-linux-androideabi --build=x86_64-unknown-linux-gnu --prefix=/build/output/curl && \
+ make && make install
+
+# jansson
+RUN curl -L -O http://www.digip.org/jansson/releases/jansson-2.7.tar.bz2 && \
+ tar -xvjf jansson-2.7.tar.bz2 && \
+ cd jansson-2.7 && ./configure --host=arm-linux-androideabi --disable-shared --enable-static --prefix=/build/output/jansson && \
+ make && make install
+
+
+# libmxl2
+RUN curl -L -O http://xmlsoft.org/sources/libxml2-2.7.2.tar.gz && \
+ curl -L -O https://raw.githubusercontent.com/bpetri/libxml2_android/master/config.guess && \
+ curl -L -O https://raw.githubusercontent.com/bpetri/libxml2_android/master/config.sub && \
+ curl -L -O https://raw.githubusercontent.com/bpetri/libxml2_android/master/libxml2.patch && \
+ tar -xvzf libxml2-2.7.2.tar.gz && cp config.guess config.sub libxml2-2.7.2 && \
+ patch -p1 < libxml2.patch && \
+ cd libxml2-2.7.2 && \
+ ./configure --host=arm-linux-androideabi --disable-shared --enable-static --prefix=/build/output/libxml2 && \
+ make && make install
+
+
+# libffi
+RUN curl -L -O ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz && \
+ tar -xvzf libffi-3.2.1.tar.gz && \
+ cd libffi-3.2.1 && ./configure --host=arm-linux-androideabi --disable-shared --enable-static --prefix=/build/output/libffi && \
+ echo "#define FFI_MMAP_EXEC_WRIT 1" >> ./arm-unknown-linux-androideabi/fficonfig.h && \
+ echo "#define FFI_MMAP_EXEC_SELINUX 0" >> ./arm-unknown-linux-androideabi/fficonfig.h && \
+ make && make install
+
+
+# finally add celix src
+ADD . celix
+#Or do git clone -> RUN git clone https://github.com/apache/celix.git celix
+
+CMD mkdir -p celix/build-android && cd celix/build-android && cmake -DANDROID=TRUE -DENABLE_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=OFF -DBUILD_RSA_TOPOLOGY_MANAGER=ON -DFFI_LIBRARY=/build/output/libffi/lib/libffi.a -DFFI_INCLUDE_DIR=/build/output/libffi/lib/libffi-3.2.1/include -DJANSSON_LIBRARY=/build/output/jansson/lib/libjansson.a -DJANSSON_INCLUDE_DIR=/build/output/jansson/include -DCURL_LIBRARY=/build/output/curl/lib/libcurl.a -DCURL_INCLUDE_DIR=/build/output/curl/include -DLIBXML2_LIBRARIES=/build/output/libxml2/lib/libxml2.a -DLIBXML2_INCLUDE_DIR=/build/output/libxml2/include/libxml2 -DZLIB_LIBRARY=/build/output/zlib/lib/libz.a -DZLIB_INCLUDE_DIR=/build/output/zlib/include -DUUID_LIBRARY=/build/output/uuid/lib/libuuid.a -DUUID_INCLUDE_DIR=/build/output/uuid/incl
ude -DCMAKE_INSTALL_PREFIX:PATH=/build/output/celix .. && make && make install-all
+
+# done
+
[34/51] celix git commit: CELIX-77: fixed memory leak,
added missing ungetService
Posted by pn...@apache.org.
CELIX-77: fixed memory leak, added missing ungetService
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/7d10d6e9
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/7d10d6e9
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/7d10d6e9
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 7d10d6e97ac9b911b1fb1e9d26a116cfd3695a04
Parents: 5834d63
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 15 08:14:17 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 15 08:14:17 2016 +0100
----------------------------------------------------------------------
config_admin/config_admin_tst/config_admin_test.cpp | 4 ++++
config_admin/service/private/src/managed_service_tracker.c | 4 ++++
2 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/7d10d6e9/config_admin/config_admin_tst/config_admin_test.cpp
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config_admin_test.cpp b/config_admin/config_admin_tst/config_admin_test.cpp
index acb6359..f75cc3a 100644
--- a/config_admin/config_admin_tst/config_admin_test.cpp
+++ b/config_admin/config_admin_tst/config_admin_test.cpp
@@ -94,6 +94,10 @@ tst2_service_pt test2Serv = NULL;
rc = bundleContext_ungetService(context, testRef, NULL);
CHECK_EQUAL(CELIX_SUCCESS, rc);
+ // check whether this is necessary
+ rc = bundleContext_ungetService(context, testRef, NULL);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
rc = bundleContext_ungetServiceReference(context, testRef);
CHECK_EQUAL(CELIX_SUCCESS, rc);
http://git-wip-us.apache.org/repos/asf/celix/blob/7d10d6e9/config_admin/service/private/src/managed_service_tracker.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_tracker.c b/config_admin/service/private/src/managed_service_tracker.c
index 642f1aa..e723f29 100644
--- a/config_admin/service/private/src/managed_service_tracker.c
+++ b/config_admin/service/private/src/managed_service_tracker.c
@@ -182,6 +182,10 @@ celix_status_t managedServiceTracker_destroy(bundle_context_pt context, managed_
updatedThreadPool_destroy(mgServTr->updatedThreadPool);
celixThreadMutex_destroy(&mgServTr->managedServicesReferencesMutex);
serviceTracker_destroy(tracker);
+
+ hashMap_destroy(mgServTr->managedServices, true, true);
+ hashMap_destroy(mgServTr->managedServicesReferences, true, true);
+
free(mgServTr);
return CELIX_SUCCESS;
[29/51] celix git commit: CELIX-77: Fix for syntax error in travix.yml
Posted by pn...@apache.org.
CELIX-77: Fix for syntax error in travix.yml
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/df91e19c
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/df91e19c
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/df91e19c
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: df91e19cc4f623dbf708de46db0be30824635266
Parents: fb8bef5
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Jan 14 11:20:23 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 14 11:20:23 2016 +0100
----------------------------------------------------------------------
.travis.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/df91e19c/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index e2308b0..fca6b4e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -56,8 +56,7 @@ before_script:
-DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON \
-DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON \
-DBUILD_SHELL_TUI=ON -DBUILD_DEVICE_ACCESS=ON \
- -DBUILD_DEVICE_ACCESS_EXAMPLE=ON \
- "
+ -DBUILD_DEVICE_ACCESS_EXAMPLE=ON "
script:
[40/51] celix git commit: CELIX-341: remove redefinition
Posted by pn...@apache.org.
CELIX-341: remove redefinition
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5403908a
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5403908a
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5403908a
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 5403908a6b6c9331fd41e2fba05770061820c315
Parents: 06779da
Author: Bjoern Petri <bp...@apache.org>
Authored: Sat Jan 16 11:08:34 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sat Jan 16 11:08:34 2016 +0100
----------------------------------------------------------------------
shell_tui/private/src/shell_tui.c | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/5403908a/shell_tui/private/src/shell_tui.c
----------------------------------------------------------------------
diff --git a/shell_tui/private/src/shell_tui.c b/shell_tui/private/src/shell_tui.c
index 4f5044c..fd5b62c 100644
--- a/shell_tui/private/src/shell_tui.c
+++ b/shell_tui/private/src/shell_tui.c
@@ -35,7 +35,6 @@
#include "shell_tui.h"
#include "utils.h"
-typedef struct shellTuiActivator * shell_tui_activator_pt;
static void* shellTui_runnable(void *data) {
shell_tui_activator_pt act = (shell_tui_activator_pt) data;
[26/51] celix git commit: CELIX-333: Adapt coverity upload url
Posted by pn...@apache.org.
CELIX-333: Adapt coverity upload url
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/acbfe389
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/acbfe389
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/acbfe389
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: acbfe389b92637bbfdbdee71e072de7d4c64f3b7
Parents: d8dbe10
Author: Bjoern Petri <bp...@apache.org>
Authored: Wed Jan 13 09:01:49 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Wed Jan 13 09:01:49 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/acbfe389/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 437d125..55eab3e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,7 +17,7 @@ env:
- COVERITY_SCAN_BRANCH_PATTERN="develop"
- COVERITY_SCAN_TOKEN="iomLSuaE8KOZLDog-KK7Ug"
- COVERITY_SCAN_BUILD_URL="https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh"
- - COVERITY_SCAN_BUILD="curl -s $COVERITY_SCAN_BUILD_URL | bash"
+ - COVERITY_SCAN_BUILD="curl -s $COVERITY_SCAN_BUILD_URL | sed "s/https:\/\/scan.coverity.com\/builds/https:\/\/scan.coverity.com\/builds?project=Apache+Celix"/g | bash"
matrix:
include:
[39/51] celix git commit: CELIX-341: fixed & refactored shell_tui
Posted by pn...@apache.org.
CELIX-341: fixed & refactored shell_tui
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/06779dac
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/06779dac
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/06779dac
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 06779dac54c801e4db13cfccbeccbef4c9473e04
Parents: 4e96cf3
Author: Bjoern Petri <bp...@apache.org>
Authored: Sat Jan 16 10:36:26 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sat Jan 16 10:36:26 2016 +0100
----------------------------------------------------------------------
shell_tui/CMakeLists.txt | 4 +-
shell_tui/private/include/shell_tui.h | 51 ++++++++
shell_tui/private/src/activator.c | 102 +++++++++++++++
shell_tui/private/src/shell_tui.c | 200 ++++++++++-------------------
4 files changed, 224 insertions(+), 133 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/06779dac/shell_tui/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell_tui/CMakeLists.txt b/shell_tui/CMakeLists.txt
index ab56f73..6690d46 100644
--- a/shell_tui/CMakeLists.txt
+++ b/shell_tui/CMakeLists.txt
@@ -22,12 +22,14 @@ if (SHELL_TUI)
SET_HEADERS("Bundle-Name: Apache Celix Shell TUI")
bundle(shell_tui
- SOURCES
+ SOURCES
+ private/src/activator
private/src/shell_tui
)
install_bundle(shell_tui)
+ include_directories("private/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
include_directories("${PROJECT_SOURCE_DIR}/shell/public/include")
target_link_libraries(shell_tui celix_framework)
http://git-wip-us.apache.org/repos/asf/celix/blob/06779dac/shell_tui/private/include/shell_tui.h
----------------------------------------------------------------------
diff --git a/shell_tui/private/include/shell_tui.h b/shell_tui/private/include/shell_tui.h
new file mode 100644
index 0000000..fec60c9
--- /dev/null
+++ b/shell_tui/private/include/shell_tui.h
@@ -0,0 +1,51 @@
+/**
+ *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.
+ */
+/*
+ * shell_tui.h
+ *
+ * \date Jan 16, 2016
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef SHELL_TUI_H_
+#define SHELL_TUI_H_
+
+#include <stdlib.h>
+
+#include "bundle_context.h"
+#include "celix_threads.h"
+#include "service_reference.h"
+#include "shell.h"
+
+struct shellTuiActivator {
+ bundle_context_pt context;
+ shell_service_pt shell;
+ service_reference_pt reference;
+ struct serviceListener * listener;
+ bool running;
+ celix_thread_t runnable;
+};
+
+typedef struct shellTuiActivator * shell_tui_activator_pt;
+
+celix_status_t shellTui_initializeService(shell_tui_activator_pt activator);
+celix_status_t shellTui_serviceChanged(service_listener_pt listener, service_event_pt event);
+
+#endif /* SHELL_TUI_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/06779dac/shell_tui/private/src/activator.c
----------------------------------------------------------------------
diff --git a/shell_tui/private/src/activator.c b/shell_tui/private/src/activator.c
new file mode 100644
index 0000000..ee03b30
--- /dev/null
+++ b/shell_tui/private/src/activator.c
@@ -0,0 +1,102 @@
+/**
+ *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.
+ */
+/*
+ * activator.c
+ *
+ * \date Jan 15, 2016
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+
+#include "bundle_context.h"
+#include "bundle_activator.h"
+
+
+#include "shell_tui.h"
+
+
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ shell_tui_activator_pt activator = (shell_tui_activator_pt) calloc(1, sizeof(*activator));
+
+ if (activator) {
+ activator->shell = NULL;
+ (*userData) = activator;
+ }
+ else {
+ status = CELIX_ENOMEM;
+ }
+
+ return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+ celix_status_t status;
+
+ shell_tui_activator_pt act = (shell_tui_activator_pt) userData;
+ service_listener_pt listener = (service_listener_pt) calloc(1, sizeof(*listener));
+
+ act->context = context;
+ act->running = true;
+
+ act->listener = listener;
+ act->listener->handle = act;
+ act->listener->serviceChanged = (void *) shellTui_serviceChanged;
+ status = bundleContext_addServiceListener(context, act->listener, "(objectClass=shellService)");
+
+ if (status == CELIX_SUCCESS) {
+ shellTui_initializeService(act);
+ }
+
+ return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+ celix_status_t status;
+ shell_tui_activator_pt activator = (shell_tui_activator_pt) userData;
+
+ bundleContext_ungetService(activator->context,activator->reference,NULL);
+ bundleContext_ungetServiceReference(activator->context,activator->reference);
+
+ status = bundleContext_removeServiceListener(context, activator->listener);
+
+ if (status == CELIX_SUCCESS) {
+ free(activator->listener);
+
+ activator->running = false;
+ activator->listener = NULL;
+ activator->context = NULL;
+ activator->running = false;
+
+ celixThread_join(activator->runnable, NULL);
+ }
+
+ return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+ shell_tui_activator_pt activator = (shell_tui_activator_pt) userData;
+
+ free(activator);
+
+ return CELIX_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/06779dac/shell_tui/private/src/shell_tui.c
----------------------------------------------------------------------
diff --git a/shell_tui/private/src/shell_tui.c b/shell_tui/private/src/shell_tui.c
index e31dff3..4f5044c 100644
--- a/shell_tui/private/src/shell_tui.c
+++ b/shell_tui/private/src/shell_tui.c
@@ -32,155 +32,91 @@
#include "bundle_context.h"
#include "bundle_activator.h"
#include "shell.h"
+#include "shell_tui.h"
#include "utils.h"
-struct shellTuiActivator {
- bundle_context_pt context;
- shell_service_pt shell;
- service_reference_pt reference;
- struct serviceListener * listener;
- bool running;
- celix_thread_t runnable;
-};
-
typedef struct shellTuiActivator * shell_tui_activator_pt;
-
static void* shellTui_runnable(void *data) {
- shell_tui_activator_pt act = (shell_tui_activator_pt) data;
-
- char in[256];
- char dline[256];
- bool needPrompt = true;
-
- fd_set rfds;
- struct timeval tv;
-
- while (act->running) {
- char * line = NULL;
- if (needPrompt) {
- printf("-> ");
- fflush(stdout);
- needPrompt = false;
- }
- FD_ZERO(&rfds);
- FD_SET(0, &rfds);
-
- tv.tv_sec = 1;
- tv.tv_usec = 0;
-
- if (select(1, &rfds, NULL, NULL, &tv)) {
- fgets(in, 256, stdin);
- needPrompt = true;
- memset(dline, 0, 256);
- strncpy(dline, in, 256);
-
- line = utils_stringTrim(dline);
- if ((strlen(line) == 0) || (act->shell == NULL)) {
- continue;
- }
-
- act->shell->executeCommand(act->shell->shell, line, stdout, stderr);
- }
- }
-
- return NULL;
+ shell_tui_activator_pt act = (shell_tui_activator_pt) data;
+
+ char in[256];
+ char dline[256];
+ bool needPrompt = true;
+
+ fd_set rfds;
+ struct timeval tv;
+
+ while (act->running) {
+ char * line = NULL;
+ if (needPrompt) {
+ printf("-> ");
+ fflush(stdout);
+ needPrompt = false;
+ }
+ FD_ZERO(&rfds);
+ FD_SET(0, &rfds);
+
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+
+ if (select(1, &rfds, NULL, NULL, &tv)) {
+ fgets(in, 256, stdin);
+ needPrompt = true;
+ memset(dline, 0, 256);
+ strncpy(dline, in, 256);
+
+ line = utils_stringTrim(dline);
+ if ((strlen(line) == 0) || (act->shell == NULL)) {
+ continue;
+ }
+
+ act->shell->executeCommand(act->shell->shell, line, stdout, stderr);
+ }
+ }
+
+ return NULL;
}
-void shellTui_initializeService(shell_tui_activator_pt activator) {
- if (activator->shell == NULL) {
- bundleContext_getServiceReference(activator->context, (char *) OSGI_SHELL_SERVICE_NAME, &activator->reference);
- if (activator->reference != NULL) {
- void *shell_svc = NULL;
- bundleContext_getService(activator->context, activator->reference, &shell_svc);
- activator->shell = (shell_service_pt) shell_svc;
- }
- }
-}
-
-void shellTui_serviceChanged(service_listener_pt listener, service_event_pt event) {
- bool result = false;
- shell_tui_activator_pt act = (shell_tui_activator_pt) listener->handle;
- bool equals = false;
-
- serviceReference_equals(act->reference, event->reference, &equals);
+celix_status_t shellTui_initializeService(shell_tui_activator_pt activator) {
- if ((event->type == OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED) && (act->reference == NULL)) {
- shellTui_initializeService(act);
- } else if ((event->type == OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING) && (equals)) {
- bundleContext_ungetService(act->context, act->reference, &result);
- act->reference = NULL;
- act->shell = NULL;
+ celix_status_t status = CELIX_SUCCESS;
- shellTui_initializeService(act);
- }
-}
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
+ if (activator->shell != NULL) {
+ status = CELIX_ILLEGAL_ARGUMENT;
+ } else {
+ status = bundleContext_getServiceReference(activator->context, (char *) OSGI_SHELL_SERVICE_NAME, &activator->reference);
- shell_tui_activator_pt activator = (shell_tui_activator_pt) calloc(1, sizeof(*activator));
+ if (status != CELIX_SUCCESS || activator->reference != NULL) {
+ void *shell_svc = NULL;
+ bundleContext_getService(activator->context, activator->reference, &shell_svc);
+ activator->shell = (shell_service_pt) shell_svc;
- if (activator) {
- activator->shell = NULL;
- (*userData) = activator;
- }
- else {
- status = CELIX_ENOMEM;
- }
+ celixThread_create(&activator->runnable, NULL, shellTui_runnable, activator);
+ }
+ }
- return status;
+ return status;
}
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status;
-
- shell_tui_activator_pt act = (shell_tui_activator_pt) userData;
- service_listener_pt listener = (service_listener_pt) malloc(sizeof(*listener));
-
- act->context = context;
- act->running = true;
-
- act->listener = listener;
- act->listener->handle = act;
- act->listener->serviceChanged = (void *) shellTui_serviceChanged;
- status = bundleContext_addServiceListener(context, act->listener, "(objectClass=shellService)");
+celix_status_t shellTui_serviceChanged(service_listener_pt listener, service_event_pt event) {
+ celix_status_t status = CELIX_SUCCESS;
- if (status == CELIX_SUCCESS) {
- shellTui_initializeService(act);
- celixThread_create(&act->runnable, NULL, shellTui_runnable, act);
- }
+ bool result = false;
+ shell_tui_activator_pt act = (shell_tui_activator_pt) listener->handle;
+ bool equals = false;
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status;
- shell_tui_activator_pt activator = (shell_tui_activator_pt) userData;
-
- bundleContext_ungetService(activator->context,activator->reference,NULL);
- bundleContext_ungetServiceReference(activator->context,activator->reference);
-
- status = bundleContext_removeServiceListener(context, activator->listener);
-
- if (status == CELIX_SUCCESS) {
- free(activator->listener);
-
- activator->running = false;
- activator->listener = NULL;
- activator->context = NULL;
- activator->running = false;
-
- celixThread_join(activator->runnable, NULL);
- }
-
- return status;
-}
+ serviceReference_equals(act->reference, event->reference, &equals);
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- shell_tui_activator_pt activator = (shell_tui_activator_pt) userData;
+ if ((event->type == OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED) && (act->reference == NULL)) {
+ status = shellTui_initializeService(act);
+ } else if ((event->type == OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING) && (equals)) {
+ bundleContext_ungetService(act->context, act->reference, &result);
+ act->reference = NULL;
+ act->shell = NULL;
- free(activator);
+ status = shellTui_initializeService(act);
+ }
- return CELIX_SUCCESS;
+ return status;
}
[31/51] celix git commit: CELIX-77: Disable config_admin. Still seems
to fail on the build server
Posted by pn...@apache.org.
CELIX-77: Disable config_admin. Still seems to fail on the build server
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/9ddda550
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/9ddda550
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/9ddda550
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 9ddda550c276a03ba6a1ba8db8e4e861b442819e
Parents: 9c7973f
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Jan 14 11:39:15 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 14 11:39:15 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/9ddda550/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index cb3745f..137f0b4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,7 +41,7 @@ before_script:
- cd -
- mkdir build install
- export BUILD_OPTIONS=" \
- -DBUILD_CONFIG_ADMIN=ON \
+ -DBUILD_CONFIG_ADMIN=OFF \
-DBUILD_RSA_REMOTE_SERVICE_ADMIN_DFI=ON \
-DBUILD_DEPLOYMENT_ADMIN=ON \
-DBUILD_DEPENDENCY_MANAGER=ON \
[37/51] celix git commit: CELIX-333: fixed coverity url
Posted by pn...@apache.org.
CELIX-333: fixed coverity url
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/141f622a
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/141f622a
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/141f622a
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 141f622a3439c9717e91ad2e96fbf878df56f5a2
Parents: 118d236
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 15 12:57:50 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 15 12:57:50 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/141f622a/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c291ba7..c15ffd9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,7 +18,7 @@ env:
- COVERITY_SCAN_BRANCH_PATTERN="develop"
- COVERITY_SCAN_TOKEN="iomLSuaE8KOZLDog-KK7Ug"
- COVERITY_SCAN_BUILD_URL="https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh"
- - COVERITY_SCAN_BUILD="curl -s $COVERITY_SCAN_BUILD_URL | sed "s/https:\/\/scan.coverity.com\/builds/https:\/\/scan.coverity.com\/builds?project=Apache+Celix"/g | bash"
+ - COVERITY_SCAN_BUILD="curl -s $COVERITY_SCAN_BUILD_URL | sed 's/https:\/\/scan.coverity.com\/builds/https:\/\/scan.coverity.com\/builds?project=Apache+Celix/g' | bash"
matrix:
include:
[05/51] celix git commit: CELIX-77: Disable -Wall and -Werror for CXX
(test code). Still some warning left
Posted by pn...@apache.org.
CELIX-77: Disable -Wall and -Werror for CXX (test code). Still some warning left
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/8bfb61f6
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/8bfb61f6
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/8bfb61f6
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 8bfb61f604ce5231ad0a324a539e2a54187213ca
Parents: f71246c
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Jan 6 16:26:09 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Jan 6 16:26:09 2016 +0100
----------------------------------------------------------------------
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/8bfb61f6/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4670987..375568c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,7 @@ ENDIF()
IF(UNIX)
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror ${CMAKE_C_FLAGS}")
- SET(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
+ #SET(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
ENDIF()
IF(UNIX AND NOT APPLE)
SET(CMAKE_C_FLAGS "-pthread ${CMAKE_C_FLAGS}")
[38/51] celix git commit: CELIX-77: revert hashMap key-free
Posted by pn...@apache.org.
CELIX-77: revert hashMap key-free
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/4e96cf30
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/4e96cf30
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/4e96cf30
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 4e96cf300d7939569468c6f781f8b8ff24883094
Parents: 141f622
Author: Bjoern Petri <bp...@apache.org>
Authored: Fri Jan 15 15:06:53 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Fri Jan 15 15:06:53 2016 +0100
----------------------------------------------------------------------
config_admin/service/private/src/configuration_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/4e96cf30/config_admin/service/private/src/configuration_store.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_store.c b/config_admin/service/private/src/configuration_store.c
index 19a416d..d4bb831 100644
--- a/config_admin/service/private/src/configuration_store.c
+++ b/config_admin/service/private/src/configuration_store.c
@@ -109,7 +109,7 @@ celix_status_t configurationStore_create(bundle_context_pt context, configuratio
celix_status_t configurationStore_destroy(configuration_store_pt store) {
celixThreadMutex_destroy(&store->mutex);
- hashMap_destroy(store->configurations, true, true);
+ hashMap_destroy(store->configurations, false, true);
free(store);
return CELIX_SUCCESS;
[27/51] celix git commit: CELIX-340: fix locking
Posted by pn...@apache.org.
CELIX-340: fix locking
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3605d26a
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3605d26a
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3605d26a
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 3605d26ac1bb6da2ed467329a3ad01c60cd1cfd5
Parents: acbfe38
Author: Bjoern Petri <bp...@apache.org>
Authored: Wed Jan 13 10:09:28 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Wed Jan 13 10:09:28 2016 +0100
----------------------------------------------------------------------
.../discovery_etcd/private/src/etcd.c | 3 +-
.../discovery_etcd/private/src/etcd_watcher.c | 43 +++++++++-----------
2 files changed, 21 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/3605d26a/remote_services/discovery_etcd/private/src/etcd.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/src/etcd.c b/remote_services/discovery_etcd/private/src/etcd.c
index a68dc77..ed06fb7 100644
--- a/remote_services/discovery_etcd/private/src/etcd.c
+++ b/remote_services/discovery_etcd/private/src/etcd.c
@@ -183,11 +183,10 @@ bool etcd_getNodes(char* directory, char** nodeNames, int* size) {
if (js_root != NULL) {
js_node = json_object_get(js_root, ETCD_JSON_NODE);
}
- if (js_root != NULL) {
+ if (js_node != NULL) {
js_nodes = json_object_get(js_node, ETCD_JSON_NODES);
}
-
if (js_nodes != NULL && json_is_array(js_nodes)) {
int i = 0;
retVal = true;
http://git-wip-us.apache.org/repos/asf/celix/blob/3605d26a/remote_services/discovery_etcd/private/src/etcd_watcher.c
----------------------------------------------------------------------
diff --git a/remote_services/discovery_etcd/private/src/etcd_watcher.c b/remote_services/discovery_etcd/private/src/etcd_watcher.c
index 919aefd..915f420 100644
--- a/remote_services/discovery_etcd/private/src/etcd_watcher.c
+++ b/remote_services/discovery_etcd/private/src/etcd_watcher.c
@@ -349,35 +349,32 @@ celix_status_t etcdWatcher_create(discovery_pt discovery, bundle_context_pt cont
}
}
- status = etcd_init(etcd_server, etcd_port);
- if (status != CELIX_SUCCESS)
- {
- return status;
- }
-
- etcdWatcher_addOwnFramework(*watcher);
-
- if ((status = celixThreadMutex_create(&(*watcher)->watcherLock, NULL)) != CELIX_SUCCESS) {
- return status;
- }
-
- if ((status = celixThreadMutex_lock(&(*watcher)->watcherLock)) != CELIX_SUCCESS) {
- return status;
- }
+ status = etcd_init(etcd_server, etcd_port);
- if ((status = celixThread_create(&(*watcher)->watcherThread, NULL, etcdWatcher_run, *watcher)) != CELIX_SUCCESS) {
- return status;
- }
+ printf(" ININT\n");
+ if (status == CELIX_SUCCESS) {
+ etcdWatcher_addOwnFramework(*watcher);
+ status = celixThreadMutex_create(&(*watcher)->watcherLock, NULL);
+ printf(" 111\n");
+ }
- (*watcher)->running = true;
+ if (status == CELIX_SUCCESS) {
+ if (celixThreadMutex_lock(&(*watcher)->watcherLock) == CELIX_SUCCESS) {
+ status = celixThread_create(&(*watcher)->watcherThread, NULL, etcdWatcher_run, *watcher);
+ if (status == CELIX_SUCCESS) {
+ printf(" STARTEDTSTARTED\n");
+ (*watcher)->running = true;
+ }
+ celixThreadMutex_unlock(&(*watcher)->watcherLock);
+ }
+ }
- if ((status = celixThreadMutex_unlock(&(*watcher)->watcherLock)) != CELIX_SUCCESS) {
- return status;
- }
- return status;
+ printf(" DONEDONE\n");
+ return status;
}
+
celix_status_t etcdWatcher_destroy(etcd_watcher_pt watcher) {
celix_status_t status = CELIX_SUCCESS;
char localNodePath[MAX_LOCALNODE_LENGTH];
[19/51] celix git commit: CELIX-338: Updated Building instructions
Posted by pn...@apache.org.
CELIX-338: Updated Building instructions
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3b82dc86
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3b82dc86
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3b82dc86
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 3b82dc866095fb4d49e02a8e09502836ac1f26a7
Parents: 52daddd
Author: Bjoern Petri <bp...@apache.org>
Authored: Mon Jan 11 09:59:32 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Mon Jan 11 09:59:32 2016 +0100
----------------------------------------------------------------------
BUILDING | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/3b82dc86/BUILDING
----------------------------------------------------------------------
diff --git a/BUILDING b/BUILDING
index 1271930..819d42b 100644
--- a/BUILDING
+++ b/BUILDING
@@ -42,16 +42,13 @@ Quick Start
Unit testing using CppUTest
---------------------------
-Apache Celix has two build options that enable a set of unit tests. These tests
-are based on CUnit a fork of CppUTest. CUnit can simply be installed and is normally
-found by the CMake scripts, but for CppUTest a fork needs to be build.
-
-The fork can be found on https://github.com/abroekhuis/cpputest/tree/backup. Simply cloning, building
-and updating the build configuration to point to the build files should be enough.
-
-Some background, CppUTest doesn't support output parameters, but Celix's API relies heavily
-on those. The fork adds support for this.
-
+Apache Celix has build options that enable a set of unit tests for each component. These tests
+are based on CppUTest, which needs to be installed separately.
+To run the tests
+ $ make test
+To get a HTML page with the test coverage
+ $ make coverage
+The coverage results are found in <build_dir>/coverage_results/index.html
Background information
----------------------
[47/51] celix git commit: CELIX-247: enable travis for android
Posted by pn...@apache.org.
CELIX-247: enable travis for android
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/8302c5f1
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/8302c5f1
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/8302c5f1
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 8302c5f1040eff201c4365fa3fd055f7a2cd6f45
Parents: 25f6497
Author: Bjoern Petri <bp...@apache.org>
Authored: Sun Jan 24 12:09:48 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sun Jan 24 12:09:48 2016 +0100
----------------------------------------------------------------------
.travis.yml | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/8302c5f1/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c15ffd9..33c2c8e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,7 @@
+sudo: required
+dist: trusty
+
language: c
os:
@@ -9,6 +12,9 @@ compiler:
- gcc
- clang
+services:
+ - docker
+
env:
global:
@@ -25,9 +31,13 @@ matrix:
- os: linux
compiler: gcc
env: SANITIZE=1
+ - os: linux
+ compiler: clang
+ env: ANDROID=1
+
before_install:
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get -qq update && sudo apt-get install -y uuid-dev libxml2-dev lcov libffi-dev gcc-4.8 g++-4.8; fi
+ - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ -z "$ANDROID" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get -qq update && sudo apt-get install -y uuid-dev libxml2-dev lcov libffi-dev gcc-4.8 g++-4.8; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update && brew install lcov libffi && brew link --force libffi; fi
before_script:
@@ -71,10 +81,10 @@ script:
# RSA_SHM is only working on linux, but both compilers (see CELIX-277)
- cd build
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export BUILD_OPTS="${BUILD_OPTS} -DENABLE_CODE_COVERAGE=ON"; fi
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_LINUX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
+ - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ -z "$ANDROID" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_LINUX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_OSX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- - make all && make deploy && make install-all
- - export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"
+ - if [ -z "$ANDROID" ]; then make all && make deploy && make install-all; else docker build -t celixandroid ..; fi
+ - if [ -z "$ANDROID" ]; then export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"; else docker run celixandroid; fi
after_success:
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then
[06/51] celix git commit: CELIX-77: Added rpath info for utils tests
Posted by pn...@apache.org.
CELIX-77: Added rpath info for utils tests
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/dfafb46c
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/dfafb46c
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/dfafb46c
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: dfafb46cd83fab1f0ee7052b0cf9e402f34d6908
Parents: 8bfb61f
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Jan 7 12:03:30 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 7 12:03:30 2016 +0100
----------------------------------------------------------------------
utils/CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/dfafb46c/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 29d797f..bdf584d 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -68,6 +68,11 @@ if (UTILS)
if (ENABLE_TESTING AND UTILS-TESTS)
find_package(CppUTest REQUIRED)
+ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+ SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/utils")
+
+
include_directories(${CUNIT_INCLUDE_DIRS})
include_directories(${CPPUTEST_INCLUDE_DIR})
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
[32/51] celix git commit: CELIX-77: Fix in travix.yml.
Posted by pn...@apache.org.
CELIX-77: Fix in travix.yml.
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/a10eef6a
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/a10eef6a
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/a10eef6a
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: a10eef6ae89b4b5a67da8f9906ab40fba05a6be9
Parents: 9ddda55
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Jan 14 11:41:27 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 14 11:41:27 2016 +0100
----------------------------------------------------------------------
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/a10eef6a/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 137f0b4..25fb546 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -70,8 +70,8 @@ script:
# RSA_SHM is only working on linux, but both compilers (see CELIX-277)
- cd build
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export BUILD_OPTS="${BUILD_OPTS} -DENABLE_CODE_COVERAGE=ON"; fi
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ${BUILD_OPTIONS} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake ${BUILD_OPTIONS} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
+ - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_LINUX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
+ - if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_OSX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- make all && make deploy && make install-all
- export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"
[02/51] celix git commit: CELIX-77: Update config_admin implementation
Posted by pn...@apache.org.
CELIX-77: Update config_admin implementation
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/d3c94184
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/d3c94184
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/d3c94184
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: d3c94184e570ecb0c73d41d006f64412e6959fa5
Parents: 62f65cf
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Jan 6 15:14:47 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Jan 6 15:14:47 2016 +0100
----------------------------------------------------------------------
CMakeLists.txt | 1 +
config_admin/CMakeLists.txt | 25 +-
config_admin/config_admin_tst/CMakeLists.txt | 51 +++
.../config_admin_tst/config.properties.in | 20 +
.../config_admin_tst/config_admin_test.cpp | 404 +++++++++++++++++++
.../example_test/CMakeLists.txt | 32 ++
.../example_test/META-INF/MANIFEST.MF | 5 +
.../include/example_managed_service_impl.h | 67 +++
.../example_test/private/src/activator.c | 205 ++++++++++
.../private/src/example_managed_service_impl.c | 97 +++++
.../example_test2/CMakeLists.txt | 32 ++
.../example_test2/META-INF/MANIFEST.MF | 5 +
.../include/example2_managed_service_impl.h | 65 +++
.../example_test2/private/src/activator.c | 225 +++++++++++
.../private/src/example_managed_service_impl.c | 103 +++++
config_admin/examples/CMakeLists.txt | 21 -
.../examples/example_test/CMakeLists.txt | 32 --
.../examples/example_test/META-INF/MANIFEST.MF | 5 -
.../include/example_managed_service_impl.h | 53 ---
.../example_test/private/src/activator.c | 188 ---------
.../private/src/example_managed_service_impl.c | 94 -----
.../examples/example_test2/CMakeLists.txt | 21 -
.../bundle_configuring/CMakeLists.txt | 30 --
.../bundle_configuring/META-INF/MANIFEST.MF | 5 -
.../bundle_configuring/private/src/activator.c | 94 -----
.../bundle_managed_service/CMakeLists.txt | 32 --
.../bundle_managed_service/META-INF/MANIFEST.MF | 5 -
.../include/example_managed_service_impl.h | 55 ---
.../private/src/activator.c | 120 ------
.../private/src/example_managed_service_impl.c | 95 -----
config_admin/readme.md | 29 ++
.../include/configuration_admin_factory.h | 2 +-
.../private/include/configuration_impl.h | 36 +-
.../private/include/configuration_store.h | 1 +
.../private/include/managed_service_tracker.h | 9 +-
.../private/include/updated_thread_pool.h | 8 +-
config_admin/service/private/src/activator.c | 10 +-
.../private/src/configuration_admin_factory.c | 25 +-
.../private/src/configuration_admin_impl.c | 13 +-
.../service/private/src/configuration_impl.c | 313 ++++++++------
.../service/private/src/configuration_store.c | 78 ++--
.../service/private/src/managed_service_impl.c | 5 +
.../private/src/managed_service_tracker.c | 166 ++++----
.../service/private/src/updated_thread_pool.c | 41 +-
.../service/public/include/configuration.h | 27 +-
.../service/public/include/managed_service.h | 2 +-
framework/private/src/service_registry.c | 4 +-
47 files changed, 1794 insertions(+), 1162 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9453411..4670987 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,6 +39,7 @@ ENDIF()
IF(UNIX)
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror ${CMAKE_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
ENDIF()
IF(UNIX AND NOT APPLE)
SET(CMAKE_C_FLAGS "-pthread ${CMAKE_C_FLAGS}")
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/CMakeLists.txt b/config_admin/CMakeLists.txt
index 8075c31..3801e6e 100644
--- a/config_admin/CMakeLists.txt
+++ b/config_admin/CMakeLists.txt
@@ -20,6 +20,29 @@ celix_subproject(CONFIG_ADMIN "Option to enable building the Config Admin Servic
if (CONFIG_ADMIN)
add_subdirectory(service)
- add_subdirectory(examples)
+# add_subdirectory(examples)
+
+ if (ENABLE_TESTING)
+ find_package(CppUTest REQUIRED)
+
+ include_directories(${CPPUTEST_INCLUDE_DIR})
+ add_subdirectory(config_admin_tst)
+# find_package(CppUTest REQUIRED)
+#
+# include_directories(${CUNIT_INCLUDE_DIRS})
+# include_directories(${CPPUTEST_INCLUDE_DIR})
+# include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+# include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/private/include")
+# include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+#
+# add_executable(config_admin_test config_admin_tst/config_admin_test.cpp)
+# target_link_libraries(config_admin_test celix_utils ${CPPUTEST_LIBRARY} pthread)
+#
+#
+# add_test(NAME run_config_admin_test COMMAND config_admin_test)
+# SETUP_TARGET_FOR_COVERAGE(config_admin_test config_admin_test ${CMAKE_BINARY_DIR}/coverage/config_admin_test/config_admin_test)
+
+ endif(ENABLE_TESTING)
+
endif (CONFIG_ADMIN)
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/CMakeLists.txt b/config_admin/config_admin_tst/CMakeLists.txt
new file mode 100644
index 0000000..ee2e2ec
--- /dev/null
+++ b/config_admin/config_admin_tst/CMakeLists.txt
@@ -0,0 +1,51 @@
+# 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.
+
+include_directories(
+ ${PROJECT_SOURCE_DIR}/framework/public/include
+ ${PROJECT_SOURCE_DIR}/utils/public/include
+ ${PROJECT_SOURCE_DIR}/utils/public/include
+ ${PROJECT_SOURCE_DIR}/config_admin/service/public/include
+ example_test/private/include
+ example_test2/private/include
+)
+
+add_subdirectory(example_test)
+add_subdirectory(example_test2)
+
+SET(CMAKE_SKIP_BUILD_RPATH FALSE) #TODO needed?
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #TODO needed?
+SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/framework" "${PROJECT_BINARY_DIR}/utils" )
+
+add_executable(config_admin_test config_admin_test.cpp)
+target_link_libraries(config_admin_test celix_framework ${CELIX_LIBRARIES} ${CPPUTEST_LIBRARY} pthread)
+
+
+get_property(config_admin_bundle_file TARGET config_admin PROPERTY BUNDLE)
+get_property(example_test_bundle_file TARGET example_test PROPERTY BUNDLE)
+get_property(example_test2_bundle_file TARGET example_test2 PROPERTY BUNDLE)
+
+configure_file(config.properties.in config.properties @ONLY)
+#configure_file(client.properties.in client.properties @ONLY)
+#configure_file(server.properties.in server.properties @ONLY)
+
+#add_dependencies(test_rsa_dfi remote_service_admin_dfi calculator)
+
+
+#ADD_TARGET_FOR_TEST(config_admin_test)
+add_test(NAME run_config_admin_test COMMAND config_admin_test)
+SETUP_TARGET_FOR_COVERAGE(config_admin_test config_admin_test ${CMAKE_BINARY_DIR}/coverage/config_admin_test/config_admin_test)
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/config.properties.in
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config.properties.in b/config_admin/config_admin_tst/config.properties.in
new file mode 100644
index 0000000..7e8c14d
--- /dev/null
+++ b/config_admin/config_admin_tst/config.properties.in
@@ -0,0 +1,20 @@
+# 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.
+
+cosgi.auto.start.1=@config_admin_bundle_file@ @example_test_bundle_file@ @example_test2_bundle_file@
+LOGHELPER_ENABLE_STDOUT_FALLBACK=true
+org.osgi.framework.storage.clean=onFirstInit
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/config_admin_test.cpp
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config_admin_test.cpp b/config_admin/config_admin_tst/config_admin_test.cpp
new file mode 100644
index 0000000..8215f15
--- /dev/null
+++ b/config_admin/config_admin_tst/config_admin_test.cpp
@@ -0,0 +1,404 @@
+/**
+ *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.
+ */
+/*
+ * array_list_test.cpp
+ *
+ * \date Sep 15, 2015
+ * \author Menno van der Graaf & Alexander
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "CppUTest/TestHarness.h"
+#include "CppUTest/TestHarness_c.h"
+#include "CppUTest/CommandLineTestRunner.h"
+
+extern "C" {
+#include "celix_threads.h"
+#include "array_list.h"
+
+#include "celix_launcher.h"
+#include "constants.h"
+#include "framework.h"
+#include "configuration_admin.h"
+#include "example_managed_service_impl.h"
+#include "example2_managed_service_impl.h"
+
+
+static framework_pt framework = NULL;
+static bundle_context_pt context = NULL;
+
+service_reference_pt confAdminRef = NULL;
+configuration_admin_service_pt confAdminServ = NULL;
+
+service_reference_pt testRef = NULL;
+tst_service_pt testServ = NULL;
+
+service_reference_pt test2Ref = NULL;
+tst2_service_pt test2Serv = NULL;
+
+ void setupFw(void) {
+ int rc = 0;
+
+ rc = celixLauncher_launch("config.properties", &framework);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ bundle_pt bundle = NULL;
+ rc = framework_getFrameworkBundle(framework, &bundle);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundle_getContext(bundle, &context);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_getServiceReference(context, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &confAdminRef);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_getService(context, confAdminRef, (void **) &confAdminServ);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_getServiceReference(context, (char *) TST_SERVICE_NAME, &testRef);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_getService(context, testRef, (void **)&testServ);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_getServiceReference(context, (char *) TST2_SERVICE_NAME, &test2Ref);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_getService(context, testRef, (void **)&test2Serv);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+ }
+
+ void teardownFw(void) {
+ int rc = 0;
+
+ rc = bundleContext_ungetService(context, testRef, NULL);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_ungetServiceReference(context, testRef);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_ungetService(context, test2Ref, NULL);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_ungetServiceReference(context, test2Ref);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_ungetService(context, confAdminRef, NULL);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ rc = bundleContext_ungetServiceReference(context, confAdminRef);
+ CHECK_EQUAL(CELIX_SUCCESS, rc);
+
+ celixLauncher_stop(framework);
+ celixLauncher_waitForShutdown(framework);
+ celixLauncher_destroy(framework);
+
+ test2Ref = NULL;
+ test2Serv = NULL;
+ testRef = NULL;
+ testServ = NULL;
+ confAdminRef = NULL;
+ confAdminServ = NULL;
+ context = NULL;
+ framework = NULL;
+ }
+
+ static void cleanUp(void) {
+ system("rm -rf .cache");
+ system("rm -rf store");
+ }
+ static void testBundles(void) {
+ printf("begin: %s\n", __func__);
+ array_list_pt bundles = NULL;
+
+ int rc = bundleContext_getBundles(context, &bundles);
+ CHECK_EQUAL(0, rc);
+ CHECK_EQUAL(4, arrayList_size(bundles)); //framework, config_admin, example_test, example_test2
+ arrayList_destroy(bundles);
+ printf("end: %s\n", __func__);
+ }
+
+
+ static void testManagedService(void) {
+ printf("begin: %s\n", __func__);
+ const char *pid = "base.device1";
+ char value[80];
+ properties_pt properties;
+ /* ------------------ get Configuration -------------------*/
+
+ configuration_pt configuration;
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin,(char *)pid, &configuration);
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ CHECK((properties == NULL));
+ testServ->get_type(testServ->handle, value);
+ CHECK_TEXT("default_value", value);
+
+ /* ------------------ clear configuration ----------------*/
+ configuration->configuration_update(configuration->handle , NULL);
+ sleep(1);
+ /* check if it is also cleared in the service */
+ testServ->get_type(testServ->handle, value);
+ CHECK_TEXT("", value);
+
+ /* ------------------ update Configuration ----------------*/
+ const char *prop1 = "type";
+ const char *value1 = "printer";
+ properties = properties_create();
+ properties_set(properties, (char *)prop1, (char *)value1);
+ // configuration_update transfers ownership of properties structure to the configuration object
+ configuration->configuration_update(configuration->handle , properties);
+
+ sleep(1);
+ testServ->get_type(testServ->handle, value);
+ CHECK_TEXT("printer", value);
+ properties = NULL;
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ if (properties != NULL) {
+ char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+ CHECK_TEXT("base.device1", test_value);
+ test_value = properties_get(properties, (char *)prop1);
+ CHECK_TEXT("printer", test_value);
+ }
+ printf("end: %s\n", __func__);
+ }
+
+ static void testManagedServicePersistent(void) {
+ printf("begin: %s\n", __func__);
+ const char *pid = "base.device1";
+ properties_pt properties = NULL;
+ const char *key = "type";
+ /* ------------------ get Configuration -------------------*/
+
+ configuration_pt configuration;
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ CHECK((properties != NULL));
+ if (properties != NULL) {
+ char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+ CHECK_TEXT("base.device1", test_value);
+ test_value = properties_get(properties, (char *)key);
+ CHECK_TEXT("printer", test_value);
+ }
+
+ printf("end: %s\n", __func__);
+ }
+
+ static void testTwoManagedService(void) {
+ printf("begin: %s\n", __func__);
+ const char *pid = "base.device1";
+ const char *tst2Pid = "test2_pid";
+ char value[80];
+ properties_pt properties;
+ properties_pt properties2;
+ /* ------------------ get Configuration -------------------*/
+
+ configuration_pt configuration;
+ configuration_pt configuration2;
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)tst2Pid, &configuration2);
+
+ /* ------------------ update Configuration ----------------*/
+ const char *prop1 = "type";
+ const char *value1 = "printer";
+ properties = properties_create();
+ properties_set(properties, (char *)prop1, (char *)value1);
+ // configuration_update transfers ownership of properties structure to the configuration object
+ configuration->configuration_update(configuration->handle , properties);
+ properties2 = properties_create();
+ properties_set(properties2, (char *)prop1, (char *)"test2_printer");
+ // configuration_update transfers ownership of properties structure to the configuration object
+ configuration2->configuration_update(configuration2->handle , properties2);
+
+ sleep(1);
+ testServ->get_type(testServ->handle, value);
+ CHECK_TEXT("printer", value);
+ test2Serv->get_type(test2Serv->handle, value);
+ CHECK_TEXT("test2_printer", value);
+ properties = NULL;
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ if (properties != NULL) {
+ char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+ CHECK_TEXT("base.device1", test_value);
+ test_value = properties_get(properties, (char *)prop1);
+ CHECK_TEXT("printer", test_value);
+ }
+ configuration2->configuration_getProperties(configuration2->handle, &properties);
+ if (properties != NULL) {
+ char *test_value = properties_get(properties, (char*)OSGI_FRAMEWORK_SERVICE_PID);
+ CHECK_TEXT("test2_pid", test_value);
+ test_value = properties_get(properties, (char *)prop1);
+ CHECK_TEXT("test2_printer", test_value);
+ }
+ printf("end: %s\n", __func__);
+ }
+
+ static void testAddManagedServiceProperty(void) {
+ printf("begin: %s\n", __func__);
+ const char *pid = "base.device1";
+ char value[80];
+ properties_pt properties;
+ /* ------------------ get Configuration -------------------*/
+
+ configuration_pt configuration;
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
+
+ /* ------------------ update Configuration ----------------*/
+ const char *prop1 = "type";
+ const char *value1 = "printer";
+ const char *prop2 = "second_type";
+ const char *value2 = "my_second_value";
+ properties = properties_create();
+ properties_set(properties, (char *)prop1, (char *)value1);
+ // configuration_update transfers ownership of properties structure to the configuration object
+ configuration->configuration_update(configuration->handle , properties);
+ sleep(1);
+ testServ->get_type(testServ->handle, value);
+ CHECK_TEXT("printer", value);
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ CHECK((properties != NULL));
+ properties_set(properties, (char *)prop2, (char *)value2);
+ // extend an existing configuration with a new property
+ configuration->configuration_update(configuration->handle, properties);
+ value2 = NULL;
+ testServ->get_second_type(testServ->handle, value);
+ CHECK_TEXT("my_second_value", value);
+ printf("end: %s\n", __func__);
+ }
+
+ static void testManagedServiceRemoved(void) {
+ printf("begin: %s\n", __func__);
+ const char *pid = "base.device1";
+ char value[80];
+ properties_pt properties = NULL;
+ bundle_pt bundle = NULL;
+ bundle_pt fwBundle = NULL;
+ bundle_archive_pt archive = NULL;
+ bundle_context_pt context = NULL;
+ char *location = NULL;
+ /* ------------------ get Configuration -------------------*/
+
+ configuration_pt configuration;
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin, (char *)pid, &configuration);
+
+ /* ------------------ update Configuration ----------------*/
+ const char *prop1 = "type";
+ const char *value1 = "printer";
+ const char *prop2 = "second_type";
+ const char *value2 = "my_second_value";
+ char org_location[128];
+ properties = properties_create();
+ properties_set(properties, (char *)prop1, (char *)value1);
+ properties_set(properties, (char *)prop2, (char *)value2);
+ // configuration_update transfers ownership of properties structure to the configuration object
+ configuration->configuration_update(configuration->handle , properties);
+ sleep(1);
+ serviceReference_getBundle(testRef, &bundle);
+ bundle_getArchive(bundle, &archive);
+ bundle_getBundleLocation(bundle, &location);
+ bundle_stop(bundle);
+ strcpy(org_location, location);
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ bundle_uninstall(bundle);
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ CHECK((properties != NULL));
+ bundle = NULL;
+ framework_getFrameworkBundle(framework, &fwBundle);
+ bundle_getContext(fwBundle, &context);
+ bundleContext_installBundle(context, org_location, &bundle);
+ bundle_startWithOptions(bundle, 0);
+ // extend an existing configuration with a new property
+ configuration->configuration_getProperties(configuration->handle, &properties);
+ CHECK((properties != NULL));
+ testRef = NULL;
+ bundleContext_getServiceReference(context, (char *) TST_SERVICE_NAME, &testRef);
+ testServ = NULL;
+ bundleContext_getService(context, testRef, (void **)&testServ);
+ testServ->get_second_type(testServ->handle, value);
+ CHECK_TEXT("my_second_value", value);
+ printf("end: %s\n", __func__);
+ }
+}
+
+
+
+int main(int argc, char** argv) {
+ return RUN_ALL_TESTS(argc, argv);
+}
+
+
+//----------------------TEST THREAD FUNCTION DECLARATIONS----------------------
+
+//----------------------TESTGROUP DEFINES----------------------
+
+TEST_GROUP(managed_service) {
+
+ void setup(void) {
+ cleanUp();
+ setupFw();
+ }
+
+ void teardown(void) {
+ teardownFw();
+ }
+
+};
+
+TEST_GROUP(managed_service_persistent) {
+
+ void setup(void) {
+ setupFw();
+ }
+
+ void teardown(void) {
+ teardownFw();
+ }
+
+};
+
+// TODO: test service factory PID
+
+//----------------------THREAD_POOL TESTS----------------------
+TEST(managed_service, test_managed_service_removed) {
+ testManagedServiceRemoved();
+}
+
+TEST(managed_service, add_managed_service_property) {
+ testAddManagedServiceProperty();
+}
+
+TEST(managed_service, test_two_managed_service) {
+ testTwoManagedService();
+}
+
+TEST(managed_service_persistent, test_persistent) {
+ testManagedServicePersistent();
+}
+
+TEST(managed_service, test_managed_service) {
+ testManagedService();
+}
+
+TEST(managed_service, test_bundles) {
+ testBundles();
+}
+
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/CMakeLists.txt b/config_admin/config_admin_tst/example_test/CMakeLists.txt
new file mode 100644
index 0000000..7782c0d
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test/CMakeLists.txt
@@ -0,0 +1,32 @@
+# 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.
+
+
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+include_directories("private/include")
+
+SET(BUNDLE_SYMBOLICNAME "example_test")
+SET(BUNDLE_VERSION "0.1.0")
+
+bundle(example_test SOURCES
+ private/src/activator
+ private/src/example_managed_service_impl
+)
+
+target_link_libraries(example_test celix_framework celix_utils config_admin)
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF b/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..15593d6
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: example_test
+Bundle-Version: 1.0.0
+library: example_test
+Import-Service: configuration_admin
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
new file mode 100644
index 0000000..6f94994
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
@@ -0,0 +1,67 @@
+/**
+ *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.
+ */
+/*
+ * example_managed_service_impl.h
+ *
+ * \date Aug 12, 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+
+#ifndef MANAGED_SERVICE_IMPL_H_
+#define MANAGED_SERVICE_IMPL_H_
+
+
+/* celix.utils*/
+#include "properties.h"
+/* celix.framework */
+#include "celix_errno.h"
+#include "service_registration.h"
+#include "bundle_context.h"
+/* celix.config_admin.ManagedService */
+#include "managed_service.h"
+
+struct test_managed_service{
+
+ bundle_context_pt context;
+
+ service_registration_pt registration;
+ properties_pt properties;
+ void *handle;
+ void (*store_props)(void *handle, char* type, char* second_type);
+
+};
+
+#define TST_SERVICE_NAME "tst_service"
+
+struct tst_service {
+ void *handle;
+ int (*get_type)(void *handle, char *value);
+ int (*get_second_type)(void *handle, char *value);
+};
+
+typedef struct tst_service *tst_service_pt;
+
+celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
+celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
+
+
+
+#endif /* MANAGED_SERVICE_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/activator.c b/config_admin/config_admin_tst/example_test/private/src/activator.c
new file mode 100644
index 0000000..4adfcaa
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test/private/src/activator.c
@@ -0,0 +1,205 @@
+/**
+ *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.
+ */
+/*
+ * activator.c
+ *
+ * \date Aug 12, 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/* celix.framework */
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "constants.h"
+#include "properties.h"
+#include "utils.h"
+/* celix.utils */
+#include "hash_map.h"
+/* celix.configadmin */
+#include "configuration_admin.h"
+#include "configuration.h"
+#include "managed_service.h"
+#include "service_registration.h"
+/* celix.config_admin.examples.private */
+#include "example_managed_service_impl.h"
+
+
+//static void test_debugConfiguration(configuration_pt configuration, char* pid);
+struct activator {
+ bundle_context_pt context;
+ tst_service_pt tstServ;
+ service_registration_pt tstReg;
+
+// struct managed_service mgmServ;
+ service_registration_pt mgmReg;
+ managed_service_pt mgmServ;
+
+ service_reference_pt configAdminServRef;
+ configuration_admin_service_pt configAdminServ;
+
+ char type_value[125];
+ char second_type_value[125];
+};
+
+
+void store_properties(void *handle, char* type, char* second) {
+ struct activator *act = (struct activator *)handle;
+ if (type == NULL)
+ act->type_value[0] = 0x00;
+ else
+ strcpy(act->type_value, type);
+ if (second == NULL)
+ act->second_type_value[0] = 0x00;
+ else
+ strcpy(act->second_type_value, second);
+}
+int my_get_type(void *handle, char* value) {
+ struct activator *act = (struct activator *)handle;
+ strcpy(value, act->type_value);
+
+ return 0;
+}
+
+int my_get_second_type(void *handle, char* value) {
+ struct activator *act = (struct activator *)handle;
+ strcpy(value, act->second_type_value);
+
+ return 0;
+}
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+ struct activator *act = calloc(1, sizeof(struct activator));
+ act->mgmReg = NULL;
+ act->mgmServ = NULL;
+ act->tstServ = calloc(1, sizeof(*act->tstServ));
+ act->tstServ->handle = act;
+ act->tstServ->get_type = my_get_type;
+ act->tstServ->get_second_type = my_get_second_type;
+ act->tstReg = NULL;
+ act->configAdminServ = NULL;
+ act->configAdminServRef = NULL;
+ act->type_value[0] = 0x00;
+ act->second_type_value[0] = 0x00;
+ *userData = act;
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
+
+ struct activator *act = (struct activator *)userData;
+ service_reference_pt ref;
+ celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
+
+ if (status == CELIX_SUCCESS) {
+
+ if (ref == NULL) {
+ printf("[configAdminClient]: ConfigAdminService reference not available\n");
+ } else {
+ configuration_admin_service_pt confAdminServ = NULL;
+ bundleContext_getService(ctx, ref, (void *) &confAdminServ);
+
+ if (confAdminServ == NULL){
+ printf("[ TEST ]: ConfigAdminService not available\n");
+ } else {
+ char *pid = "base.device1";
+ properties_pt dictionary;
+ configuration_pt configuration;
+ /* ------------------ get Configuration -------------------*/
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &configuration);
+ act->configAdminServ = confAdminServ;
+ act->configAdminServRef = ref;
+
+ status = managedServiceImpl_create(ctx, &act->mgmServ);
+ if (status != CELIX_SUCCESS){
+ return status;
+ }
+ struct test_managed_service *test_msp = (struct test_managed_service*)act->mgmServ;
+ test_msp->handle = act;
+ test_msp->store_props = store_properties;
+
+ managed_service_service_pt managedService;
+ status = managedService_create(ctx, &managedService);
+ if (status != CELIX_SUCCESS){
+ return status;
+ }
+
+ managedService->managedService = act->mgmServ;
+ managedService->updated = managedServiceImpl_updated;
+ configuration->configuration_getProperties(configuration->handle, &dictionary);
+ if (dictionary == NULL) {
+ dictionary = properties_create();
+ properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
+ properties_set(dictionary, (char *) "type", (char*)"default_value");
+ }
+ status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
+ managedService, dictionary, &act->mgmReg);
+ if (status != CELIX_SUCCESS){
+ printf("[ ERROR ]: Managed Service not registered \n");
+ return status;
+ }
+
+ status = bundleContext_registerService(ctx, (char *)TST_SERVICE_NAME, act->tstServ, NULL, &act->tstReg);
+
+ }
+ }
+ }
+ return status;
+
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+ celix_status_t status;
+ struct activator *act = (struct activator *)userData;
+ if (act->mgmReg != NULL)
+ status = serviceRegistration_unregister(act->mgmReg);
+ if (act->tstReg != NULL)
+ status = serviceRegistration_unregister(act->tstReg);
+ if (act->configAdminServRef != NULL) {
+ status = bundleContext_ungetService(context, act->configAdminServRef, NULL);
+ status = bundleContext_ungetServiceReference(context, act->configAdminServRef);
+ }
+ return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+ struct activator *act = (struct activator *)userData;
+ managedService_destroy(act->mgmServ);
+ free(act->tstServ);
+ free(act);
+ return CELIX_SUCCESS;
+}
+
+#if 0
+void test_debugConfiguration(configuration_pt configuration, char* pid){
+
+ if (configuration == NULL){
+ printf("[ TEST ]: Configuration(pid=%s) is NULL \n", pid);
+ } else{
+ printf("[ TEST ]: Configuration(pid=%s) OK \n", pid);
+ }
+
+}
+#endif
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
new file mode 100644
index 0000000..02d5df5
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
@@ -0,0 +1,97 @@
+/**
+ *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.
+ */
+/*
+ * example_managed_service_impl.c
+ *
+ * \date Aug 12, 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "example_managed_service_impl.h"
+
+/* ------------------------ Constructor -------------------------------------*/
+
+celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance){
+
+ celix_status_t status = CELIX_SUCCESS;
+
+ struct test_managed_service *managedService = calloc(1, sizeof(*managedService));
+ if(!managedService){
+ printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
+ return CELIX_ENOMEM;
+ }
+
+ managedService->context = context;
+ managedService->registration = NULL;
+ managedService->properties = NULL;
+
+ printf("[ ManagedServiceImpl ]: ManagedServiceImpl - Initialized \n");
+ *instance = (managed_service_pt)managedService;
+ return status;
+}
+
+
+/* -------------------- Implementation --------------------------------------*/
+
+celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt properties){
+ struct test_managed_service *msp = (struct test_managed_service *) managedService;
+
+ if (properties == NULL){
+ printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
+ msp->store_props(msp->handle, "", "");
+ }else{
+ printf("[ managedServiceImpl ]: updated - Received New Properties \n");
+ char *value = properties_get(properties, "type");
+ char *value2 = properties_get(properties, "second_type");
+ msp->store_props(msp->handle, value, value2);
+ // it would be nicer if we get the property values here and store them in the activator structure.
+ }
+
+ return CELIX_SUCCESS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/CMakeLists.txt b/config_admin/config_admin_tst/example_test2/CMakeLists.txt
new file mode 100644
index 0000000..ddad504
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test2/CMakeLists.txt
@@ -0,0 +1,32 @@
+# 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.
+
+
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+include_directories("private/include")
+
+SET(BUNDLE_SYMBOLICNAME "example_test2")
+SET(BUNDLE_VERSION "0.1.0")
+
+bundle(example_test2 SOURCES
+ private/src/activator
+ private/src/example_managed_service_impl
+)
+
+target_link_libraries(example_test2 celix_framework celix_utils config_admin)
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF b/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..15593d6
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test2/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: example_test
+Bundle-Version: 1.0.0
+library: example_test
+Import-Service: configuration_admin
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
new file mode 100644
index 0000000..8292721
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
@@ -0,0 +1,65 @@
+/**
+ *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.
+ */
+/*
+ * example_managed_service_impl.h
+ *
+ * \date Aug 12, 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+
+#ifndef TEST2_SERVICE_IMPL_H_
+#define TEST2_SERVICE_IMPL_H_
+
+
+/* celix.utils*/
+#include "properties.h"
+/* celix.framework */
+#include "celix_errno.h"
+#include "service_registration.h"
+#include "bundle_context.h"
+/* celix.config_admin.ManagedService */
+#include "managed_service.h"
+
+/*
+struct managed_service2{
+
+ bundle_context_pt context;
+
+ service_registration_pt registration;
+ properties_pt properties;
+
+};
+*/
+#define TST2_SERVICE_NAME "tst2_service"
+
+struct tst2_service {
+ void *handle;
+ int (*get_type)(void *handle, char *value);
+};
+
+typedef struct tst2_service *tst2_service_pt;
+
+celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
+celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
+
+
+
+#endif /* TEST2_SERVICE_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test2/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/activator.c b/config_admin/config_admin_tst/example_test2/private/src/activator.c
new file mode 100644
index 0000000..400c63c
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test2/private/src/activator.c
@@ -0,0 +1,225 @@
+/**
+ *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.
+ */
+/*
+ * activator.c
+ *
+ * \date Aug 12, 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "example2_managed_service_impl.h"
+/* celix.framework */
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "constants.h"
+#include "properties.h"
+#include "utils.h"
+/* celix.utils */
+#include "hash_map.h"
+/* celix.configadmin */
+#include "configuration_admin.h"
+#include "configuration.h"
+#include "managed_service.h"
+#include "service_registration.h"
+/* celix.config_admin.examples.private */
+
+
+//static void test_debugConfiguration(configuration_pt configuration, char* pid);
+struct activator {
+ bundle_context_pt context;
+ tst2_service_pt tstServ;
+ service_registration_pt tstReg;
+
+ service_registration_pt mgmReg;
+ managed_service_pt mgmServ;
+
+ service_reference_pt configAdminServRef;
+ configuration_admin_service_pt configAdminServ;
+
+ configuration_pt configuration;
+
+};
+
+
+int my_get_type(void *handle, char* value) {
+ struct activator *act = (struct activator *)handle;
+ if (act->configuration != NULL) {
+ properties_pt propsRx;
+ act->configuration->configuration_getProperties(act->configuration->handle, &propsRx);
+ if (propsRx != NULL) {
+ printf("[ TEST ]: PROP=%s - VALUE=%s \n", (char*)OSGI_FRAMEWORK_SERVICE_PID, properties_get(propsRx,(char*)OSGI_FRAMEWORK_SERVICE_PID));
+ strcpy(value, properties_get(propsRx,"type"));
+ }
+ else {
+ printf("[ TEST ]: No properties found \n");
+ strcpy(value, "");
+ }
+ }
+ else
+ value[0] = 0x00;
+ return 0;
+}
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+ struct activator *act = calloc(1, sizeof(struct activator));
+ act->mgmReg = NULL;
+ act->mgmServ = NULL;
+ act->tstServ = calloc(1, sizeof(*act->tstServ));
+ act->tstServ->handle = act;
+ act->tstServ->get_type = my_get_type;
+ act->tstReg = NULL;
+ act->configAdminServ = NULL;
+ act->configAdminServRef = NULL;
+ act->configuration = NULL;
+ *userData = act;
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
+
+ struct activator *act = (struct activator *)userData;
+ service_reference_pt ref;
+ celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
+
+ if (status == CELIX_SUCCESS) {
+
+ if (ref == NULL) {
+ printf("[configAdminClient]: ConfigAdminService reference not available\n");
+ } else {
+ configuration_admin_service_pt confAdminServ = NULL;
+ bundleContext_getService(ctx, ref, (void *) &confAdminServ);
+
+ if (confAdminServ == NULL){
+ printf("[ TEST ]: ConfigAdminService not available\n");
+ } else {
+ char *pid = "test2_pid";
+ /* In example_test a managed service is registered for which there already exists a
+ * configuration object. In this case, a managed service is register for which there
+ * is no configuration object in the configAdmin
+ */
+ /* ------------------ get Configuration -------------------*
+ (*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &act->configuration);
+ */
+ act->configAdminServ = confAdminServ;
+ act->configAdminServRef = ref;
+
+ status = managedServiceImpl_create(ctx, &act->mgmServ);
+ if (status != CELIX_SUCCESS){
+ return status;
+ }
+
+ managed_service_service_pt managedService;
+ status = managedService_create(ctx, &managedService);
+ if (status != CELIX_SUCCESS){
+ return status;
+ }
+
+ managedService->managedService = act->mgmServ;
+ managedService->updated = managedServiceImpl_updated;
+
+ properties_pt dictionary;
+ dictionary = properties_create();
+ properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
+ properties_set(dictionary, (char *) "type", (char*)"test2_default_value");
+
+ status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
+ managedService, dictionary, &act->mgmReg);
+ if (status != CELIX_SUCCESS){
+ printf("[ ERROR ]: Managed Service not registered \n");
+ return status;
+ }
+
+ status = bundleContext_registerService(ctx, (char *)TST2_SERVICE_NAME, act->tstServ, NULL, &act->tstReg);
+
+#if 0
+ /* ------------------ update Configuration ----------------*/
+
+ printf("------------------- TEST04 -------------------- \n");
+ printf("[ TEST ]: configuration update NULL \n");
+ configuration_update(configuration , NULL);
+
+ /* ------------------ update Configuration ----------------*/
+
+ printf("------------------- TEST05 -------------------- \n");
+ printf("[ TEST ]: configuration update New Properties \n");
+ char *prop1 = "type";
+ char *value1 = "printer";
+ properties_pt properties = properties_create();
+ properties_set(properties, prop1, value1);
+ configuration_update(configuration , properties);
+
+ /* ------------------ Configuration get Props ----------------*/
+
+ printf("------------------- TEST06 -------------------- \n");
+ printf("[ TEST ]: configuration get properties \n");
+
+ properties_pt propsRx = properties_create();
+ configuration_getProperties(configuration, &propsRx);
+
+ printf("[ TEST ]: PROP=%s - VALUE=%s \n", (char*)OSGI_FRAMEWORK_SERVICE_PID, properties_get(propsRx,(char*)OSGI_FRAMEWORK_SERVICE_PID));
+ printf("[ TEST ]: PROP=%s - VALUE=%s \n", prop1, properties_get(propsRx,prop1));
+
+ printf("/////////////////// END TESTS ///////////////// \n");
+#endif
+ }
+ }
+ }
+ return status;
+
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+ celix_status_t status;
+ struct activator *act = (struct activator *)userData;
+ if (act->mgmReg != NULL)
+ status = serviceRegistration_unregister(act->mgmReg);
+ if (act->tstReg != NULL)
+ status = serviceRegistration_unregister(act->tstReg);
+ if (act->configAdminServRef != NULL) {
+ status = bundleContext_ungetService(context, act->configAdminServRef, NULL);
+ status = bundleContext_ungetServiceReference(context, act->configAdminServRef);
+ }
+ return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+ struct activator *act = (struct activator *)userData;
+ managedService_destroy(act->mgmServ);
+ free(act->tstServ);
+ free(act);
+ return CELIX_SUCCESS;
+}
+
+#if 0
+void test_debugConfiguration(configuration_pt configuration, char* pid){
+
+ if (configuration == NULL){
+ printf("[ TEST ]: Configuration(pid=%s) is NULL \n", pid);
+ } else{
+ printf("[ TEST ]: Configuration(pid=%s) OK \n", pid);
+ }
+
+}
+#endif
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
new file mode 100644
index 0000000..270e705
--- /dev/null
+++ b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
@@ -0,0 +1,103 @@
+/**
+ *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.
+ */
+/*
+ * example_managed_service_impl.c
+ *
+ * \date Aug 12, 2013
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "example2_managed_service_impl.h"
+
+
+struct managed_service{
+
+ bundle_context_pt context;
+
+ service_registration_pt registration;
+ properties_pt properties;
+
+};
+
+/* ------------------------ Constructor -------------------------------------*/
+
+celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance){
+
+ celix_status_t status = CELIX_SUCCESS;
+
+ managed_service_pt managedService = calloc(1, sizeof(*managedService));
+ if(!managedService){
+ printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
+ return CELIX_ENOMEM;
+ }
+
+ managedService->context = context;
+ managedService->registration = NULL;
+ managedService->properties = NULL;
+
+ *instance = managedService;
+ return status;
+}
+
+
+/* -------------------- Implementation --------------------------------------*/
+
+celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt properties){
+
+ if (properties == NULL){
+ printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
+ managedService->properties = NULL;
+ }else{
+ printf("[ managedServiceImpl ]: updated - Received New Properties \n");
+ managedService->properties = properties_create();
+ managedService->properties = properties;
+ }
+
+ return CELIX_SUCCESS;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/CMakeLists.txt b/config_admin/examples/CMakeLists.txt
deleted file mode 100644
index 6c0188d..0000000
--- a/config_admin/examples/CMakeLists.txt
+++ /dev/null
@@ -1,21 +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.
-
-
-add_subdirectory(example_test)
-add_subdirectory(example_test2)
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test/CMakeLists.txt b/config_admin/examples/example_test/CMakeLists.txt
deleted file mode 100644
index 5529d45..0000000
--- a/config_admin/examples/example_test/CMakeLists.txt
+++ /dev/null
@@ -1,32 +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.
-
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
-include_directories("private/include")
-
-SET(BUNDLE_SYMBOLICNAME "example_test")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(example_test SOURCES
- private/src/activator
- private/src/example_managed_service_impl
-)
-
-target_link_libraries(example_test celix_framework celix_utils config_admin ${APR_LIBRARY})
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test/META-INF/MANIFEST.MF b/config_admin/examples/example_test/META-INF/MANIFEST.MF
deleted file mode 100644
index 15593d6..0000000
--- a/config_admin/examples/example_test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-SymbolicName: example_test
-Bundle-Version: 1.0.0
-library: example_test
-Import-Service: configuration_admin
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test/private/include/example_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test/private/include/example_managed_service_impl.h b/config_admin/examples/example_test/private/include/example_managed_service_impl.h
deleted file mode 100644
index de51c6f..0000000
--- a/config_admin/examples/example_test/private/include/example_managed_service_impl.h
+++ /dev/null
@@ -1,53 +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.
- */
-/*
- * example_managed_service_impl.h
- *
- * \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-
-#ifndef MANAGED_SERVICE_IMPL_H_
-#define MANAGED_SERVICE_IMPL_H_
-
-
-/* celix.utils*/
-#include "properties.h"
-/* celix.framework */
-#include "celix_errno.h"
-#include "service_registration.h"
-#include "bundle_context.h"
-/* celix.config_admin.ManagedService */
-#include "managed_service.h"
-
-struct managed_service{
-
- bundle_context_pt context;
-
- service_registration_pt registration;
- properties_pt properties;
-
-};
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
-celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
-
-#endif /* MANAGED_SERVICE_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test/private/src/activator.c b/config_admin/examples/example_test/private/src/activator.c
deleted file mode 100644
index f1d985e..0000000
--- a/config_admin/examples/example_test/private/src/activator.c
+++ /dev/null
@@ -1,188 +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.
- */
-/*
- * activator.c
- *
- * \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* celix.framework */
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "constants.h"
-#include "properties.h"
-#include "utils.h"
-/* celix.utils */
-#include "hash_map.h"
-/* celix.configadmin */
-#include "configuration_admin.h"
-#include "configuration.h"
-#include "managed_service.h"
-/* celix.config_admin.examples.private */
-#include "example_managed_service_impl.h"
-
-
-static void test_debugConfiguration(configuration_pt configuration, char* pid);
-
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- *userData = NULL;
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-
- service_reference_pt ref = NULL;
- celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
-
- if (status == CELIX_SUCCESS) {
-
- if (ref == NULL) {
-
- printf("[configAdminClient]: ConfigAdminService reference not available\n");
-
- } else {
-
- printf("------------------- DEMO ---------------------- \n");
-
- configuration_admin_service_pt confAdminServ = NULL;
- bundleContext_getService(ctx, ref, (void *) &confAdminServ);
-
- if (confAdminServ == NULL){
-
- printf("[ TEST ]: ConfigAdminService not available\n");
-
- } else {
-
- printf("/////////////////// TESTS ///////////////////// \n");
-
- char *pid = "base.device1";
-
- /* ------------------ get Configuration -------------------*/
-
- printf("------------------- TEST01 -------------------- \n");
- printf("[ TEST ]: getConfiguration(pid=%s) - It's new \n",pid);
- configuration_pt configuration;
- (*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &configuration);
-
- test_debugConfiguration(configuration, pid);
-
- /* ------------------ get Configuration -------------------*/
-
- char *pid2 = "base.device1";
-
- printf("------------------- TEST02--------------------- \n");
- printf("[ TEST ]: getConfiguration(pid=%s) - Looking for it in Cache \n",pid2);
- configuration_pt configuration2;
- (*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid2, &configuration2);
-
- test_debugConfiguration(configuration2, pid2);
-
- /* ------------------ register ManagedService -------------*/
-
- printf("------------------- TEST03 -------------------- \n");
- printf("[ TEST ]: register ManagedService(pid=%s) \n",pid);
-
-
- managed_service_pt instance;
- status = managedServiceImpl_create(ctx, &instance);
- if (status != CELIX_SUCCESS){
- return status;
- }
-
- managed_service_service_pt managedService;
- status = managedService_create(ctx, &managedService);
- if (status != CELIX_SUCCESS){
- return status;
- }
-
- managedService->managedService = instance;
- managedService->updated = managedServiceImpl_updated;
-
- properties_pt dictionary;
- dictionary = properties_create();
- properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
-
- status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
- managedService, dictionary, &instance->registration);
- if (status != CELIX_SUCCESS){
- printf("[ ERROR ]: Managed Service not registered \n");
- return status;
- }
-
- printf("[ TEST ]: ManagedService(pid=%s) registered \n",pid);
-
- /* ------------------ update Configuration ----------------*/
-
- printf("------------------- TEST04 -------------------- \n");
- printf("[ TEST ]: configuration update NULL \n");
- configuration_update(configuration , NULL);
-
- /* ------------------ update Configuration ----------------*/
-
- printf("------------------- TEST05 -------------------- \n");
- printf("[ TEST ]: configuration update New Properties \n");
- char *prop1 = "type";
- char *value1 = "printer";
- properties_pt properties = properties_create();
- properties_set(properties, prop1, value1);
- configuration_update(configuration , properties);
-
- /* ------------------ Configuration get Props ----------------*/
-
- printf("------------------- TEST06 -------------------- \n");
- printf("[ TEST ]: configuration get properties \n");
-
- properties_pt propsRx = properties_create();
- configuration_getProperties(configuration, &propsRx);
-
- printf("[ TEST ]: PROP=%s - VALUE=%s \n", (char*)OSGI_FRAMEWORK_SERVICE_PID, properties_get(propsRx,(char*)OSGI_FRAMEWORK_SERVICE_PID));
- printf("[ TEST ]: PROP=%s - VALUE=%s \n", prop1, properties_get(propsRx,prop1));
-
- printf("/////////////////// END TESTS ///////////////// \n");
-
- }
- }
- }
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- return CELIX_SUCCESS;
-}
-
-void test_debugConfiguration(configuration_pt configuration, char* pid){
-
- if (configuration == NULL){
- printf("[ TEST ]: Configuration(pid=%s) is NULL \n", pid);
- } else{
- printf("[ TEST ]: Configuration(pid=%s) OK \n", pid);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test/private/src/example_managed_service_impl.c b/config_admin/examples/example_test/private/src/example_managed_service_impl.c
deleted file mode 100644
index c4dab02..0000000
--- a/config_admin/examples/example_test/private/src/example_managed_service_impl.c
+++ /dev/null
@@ -1,94 +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.
- */
-/*
- * example_managed_service_impl.c
- *
- * \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "example_managed_service_impl.h"
-
-/* ------------------------ Constructor -------------------------------------*/
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance){
-
- celix_status_t status = CELIX_SUCCESS;
-
- managed_service_pt managedService = calloc(1, sizeof(*managedService));
- if(!managedService){
- printf("[ ERROR ]: ManagedServiceImpl - Not initialized (ENOMEM) \n");
- return CELIX_ENOMEM;
- }
-
- managedService->context = context;
- managedService->registration = NULL;
- managedService->properties = NULL;
-
- printf("[ ManagedServiceImpl ]: ManagedServiceImpl - Initialized \n");
- *instance = managedService;
- return status;
-}
-
-
-/* -------------------- Implementation --------------------------------------*/
-
-celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt properties){
-
- if (properties == NULL){
- printf("[ managedServiceImpl ]: updated - Received NULL properties \n");
- managedService->properties = NULL;
- }else{
- printf("[ managedServiceImpl ]: updated - Received New Properties \n");
- managedService->properties = properties_create();
- managedService->properties = properties;
- }
-
- return CELIX_SUCCESS;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/CMakeLists.txt b/config_admin/examples/example_test2/CMakeLists.txt
deleted file mode 100644
index 4adf560..0000000
--- a/config_admin/examples/example_test2/CMakeLists.txt
+++ /dev/null
@@ -1,21 +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.
-
-
-add_subdirectory(bundle_configuring)
-add_subdirectory(bundle_managed_service)
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt b/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
deleted file mode 100644
index 344ace2..0000000
--- a/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
+++ /dev/null
@@ -1,30 +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.
-
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
-
-SET(BUNDLE_SYMBOLICNAME "bundle_configuraring")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(bundle_configuring SOURCES
- private/src/activator
-)
-
-target_link_libraries(bundle_configuring celix_framework celix_utils config_admin ${APR_LIBRARY})
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF b/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF
deleted file mode 100644
index e8f0896..0000000
--- a/config_admin/examples/example_test2/bundle_configuring/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-SymbolicName: bundle_configuring
-Bundle-Version: 1.0.0
-library: bundle_configuring
-Import-Service: configuration_admin
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c b/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c
deleted file mode 100644
index 8ba4122..0000000
--- a/config_admin/examples/example_test2/bundle_configuring/private/src/activator.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- ============================================================================
- Name : activator.c
- Developed at : Thales
- Supervisor : Pepijn NOLTES
- Author : Jorge SANCHEZ
- Version : 0.1 - Jul 12, 2013
- Package : celix.config_admin.examples.example_test2
- Description : Example
- Reviews :
- ============================================================================
- */
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* celix.framework */
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "constants.h"
-#include "properties.h"
-#include "utils.h"
-/* celix.utils */
-#include "hash_map.h"
-/* celix.configadmin */
-#include "configuration_admin.h"
-#include "configuration.h"
-
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- *userData = NULL;
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-
- service_reference_pt ref = NULL;
- celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
-
- if (status == CELIX_SUCCESS) {
-
- if (ref == NULL) {
-
- printf("[configAdminClient]: ConfigAdminService reference not available\n");
-
- } else {
-
- configuration_admin_service_pt confAdminServ = NULL;
- bundleContext_getService(ctx, ref, (void *) &confAdminServ);
-
- if (confAdminServ == NULL){
-
- printf("[ BUNDLE configuring ]: ConfigAdminService not available\n");
-
- } else {
-
- char *pid = "base.device1";
-
- configuration_pt configuration;
- char *configurationLocation;
-
- /* ------------------ get Configuration -------------------*/
- printf("[ BUNDLE configuring ]: getConfiguration(pid=%s) \n",pid);
-
- (*confAdminServ->getConfiguration)(confAdminServ->configAdmin,pid, &configuration);
-
- /* ------------------ Configuration get Props ----------------*/
- printf("[ BUNDLE configuring ]: configuration getBundleLocation \n");
-
- configuration_getBundleLocation(configuration, &configurationLocation);
-
- /* -------------------- Validation ---------------------------*/
-
- printf("[ BUNDLE configuring ]: I have a Configuration that belongs to: \n ");
- printf(" %s \n ", configurationLocation);
-
- printf("[ BUNDLE configuring ]: END \n");
-
- }
- }
- }
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- return CELIX_SUCCESS;
-}
-
-
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt b/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
deleted file mode 100644
index 3de8d69..0000000
--- a/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
+++ /dev/null
@@ -1,32 +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.
-
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
-include_directories("private/include")
-
-SET(BUNDLE_SYMBOLICNAME "bundle_managed_service")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(bundle_managed_service SOURCES
- private/src/activator
- private/src/example_managed_service_impl
-)
-
-target_link_libraries(bundle_managed_service celix_framework celix_utils config_admin ${APR_LIBRARY})
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF b/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF
deleted file mode 100644
index 3ed3eab..0000000
--- a/config_admin/examples/example_test2/bundle_managed_service/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-SymbolicName: bundle_managed_service
-Bundle-Version: 1.0.0
-library: bundle_managed_service
-Import-Service: configuration_admin
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h b/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h
deleted file mode 100644
index 6089826..0000000
--- a/config_admin/examples/example_test2/bundle_managed_service/private/include/example_managed_service_impl.h
+++ /dev/null
@@ -1,55 +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.
- */
-/*
- * example_managed_service_impl.h
- *
- * \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-
-#ifndef MANAGED_SERVICE_IMPL_H_
-#define MANAGED_SERVICE_IMPL_H_
-
-
-/* celix.utils*/
-#include "properties.h"
-/* celix.framework */
-#include "celix_errno.h"
-#include "service_registration.h"
-#include "bundle_context.h"
-/* celix.config_admin.ManagedService */
-#include "managed_service.h"
-
-
-struct managed_service{
-
- bundle_context_pt context;
-
- service_registration_pt registration;
- properties_pt properties;
-
-};
-
-
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
-celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
-
-#endif /* MANAGED_SERVICE_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/d3c94184/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c b/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c
deleted file mode 100644
index 5f0d961..0000000
--- a/config_admin/examples/example_test2/bundle_managed_service/private/src/activator.c
+++ /dev/null
@@ -1,120 +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.
- */
-/*
- * activator.c
- *
- * \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* celix.framework */
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "constants.h"
-#include "properties.h"
-#include "utils.h"
-/* celix.utils */
-#include "hash_map.h"
-/* celix.configadmin */
-#include "configuration_admin.h"
-#include "configuration.h"
-#include "managed_service.h"
-/* celix.config_admin.examples.private */
-#include "example_managed_service_impl.h"
-
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
-
- service_reference_pt ref = NULL;
- celix_status_t status = bundleContext_getServiceReference(ctx, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, &ref);
-
- if (status == CELIX_SUCCESS) {
-
- if (ref == NULL) {
-
- printf("[configAdminClient]: ConfigAdminService reference not available\n");
-
- } else {
-
- printf("------------------- DEMO ---------------------- \n");
-
- configuration_admin_service_pt confAdminServ = NULL;
- bundleContext_getService(ctx, ref, (void *) &confAdminServ);
-
- if (confAdminServ == NULL){
-
- printf("[ TEST ]: ConfigAdminService not available\n");
-
- } else {
-
- char *pid = "base.device1";
- /* ------------------ register ManagedService -------------*/
-
- printf("[ BUNDLE example_managed_service ]: register ManagedService(pid=%s) \n",pid);
-
-
- managed_service_pt instance;
- status = managedServiceImpl_create(ctx, &instance);
- if (status != CELIX_SUCCESS){
- return status;
- }
-
- managed_service_service_pt managedService;
- status = managedService_create(ctx, &managedService);
- if (status != CELIX_SUCCESS){
- return status;
- }
-
- managedService->managedService = instance;
- managedService->updated = managedServiceImpl_updated;
-
- properties_pt dictionary;
- dictionary = properties_create();
- properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
-
- status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
- managedService, dictionary, &instance->registration);
- if (status != CELIX_SUCCESS){
- printf("[ ERROR ]: Managed Service not registered \n");
- return status;
- }
-
- printf("[ BUNDLE example_managed_service ]: ManagedService(pid=%s) registered \n",pid);
-
- }
- }
- }
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- return CELIX_SUCCESS;
-}
-
-
[10/51] celix git commit: CELIX-246: Adapt path to llvm-symbolizer
Posted by pn...@apache.org.
CELIX-246: Adapt path to llvm-symbolizer
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/82c8c67f
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/82c8c67f
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/82c8c67f
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 82c8c67f0cabd1935041597daceca1a523362356
Parents: 613cd7f
Author: Bjoern Petri <bp...@apache.org>
Authored: Thu Jan 7 16:26:07 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Thu Jan 7 16:26:07 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/82c8c67f/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 75c2440..fc1aa49 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,7 +32,7 @@ before_script:
script:
- - if [ "$SANITIZE" == 1 ]; then export CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 CFLAGS="-lasan -fsanitize=address" CXXFLAGS="-lasan -fsanitize=address" ASAN_OPTIONS="symbolize=1" ASAN_SYMBOLIZER_PATH="/usr/bin/asan_symbolize"; fi
+ - if [ "$SANITIZE" == 1 ]; then export CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 CFLAGS="-lasan -fsanitize=address" CXXFLAGS="-lasan -fsanitize=address" ASAN_OPTIONS="symbolize=1" ASAN_SYMBOLIZER_PATH="/usr/local/clang-3.4/bin/llvm-symbolizer"; fi
# the following setup is broken:
# RSA_DISCOVERY_SHM is only working on linux, but both compilers (see CELIX-277)
# RSA_SHM is only working on linux, but both compilers (see CELIX-277)
[24/51] celix git commit: CELIX-77: Fix test for change in
service_factory
Posted by pn...@apache.org.
CELIX-77: Fix test for change in service_factory
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/1131b821
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/1131b821
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/1131b821
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 1131b821dbc4239f3b2f9352ed1e77f290b894b2
Parents: 49ddf57
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Tue Jan 12 20:28:40 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Tue Jan 12 20:28:40 2016 +0100
----------------------------------------------------------------------
framework/private/test/service_registration_test.cpp | 8 ++++----
framework/private/test/service_registry_test.cpp | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/1131b821/framework/private/test/service_registration_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/service_registration_test.cpp b/framework/private/test/service_registration_test.cpp
index 57aedf1..b388de3 100644
--- a/framework/private/test/service_registration_test.cpp
+++ b/framework/private/test/service_registration_test.cpp
@@ -280,11 +280,11 @@ TEST(service_registration, getServiceFromFactory) {
void *service = (void *) 0x30;
service_factory_pt factory = (service_factory_pt) malloc(sizeof(*factory));
factory->getService = serviceRegistrationTest_getService;
- factory->factory = (void*) 0x40;
+ factory->handle = (void*) 0x40;
service_registration_pt registration = serviceRegistration_createServiceFactory(callback, bundle, name, 0, factory, NULL);
mock().expectOneCall("serviceRegistrationTest_getService")
- .withParameter("factory", factory->factory)
+ .withParameter("factory", factory->handle)
.withParameter("bundle", bundle)
.withParameter("registration", registration)
.withOutputParameterReturning("service", &service, sizeof(service));
@@ -306,12 +306,12 @@ TEST(service_registration, ungetServiceFromFactory) {
void *service = (void *) 0x30;
service_factory_pt factory = (service_factory_pt) malloc(sizeof(*factory));
factory->ungetService = serviceRegistrationTest_ungetService;
- factory->factory = (void*) 0x40;
+ factory->handle = (void*) 0x40;
service_registration_pt registration = serviceRegistration_createServiceFactory(callback, bundle, name, 0, factory, NULL);
mock().expectOneCall("serviceRegistrationTest_ungetService")
- .withParameter("factory", factory->factory)
+ .withParameter("factory", factory->handle)
.withParameter("bundle", bundle)
.withParameter("registration", registration)
.withOutputParameterReturning("service", &service, sizeof(service));
http://git-wip-us.apache.org/repos/asf/celix/blob/1131b821/framework/private/test/service_registry_test.cpp
----------------------------------------------------------------------
diff --git a/framework/private/test/service_registry_test.cpp b/framework/private/test/service_registry_test.cpp
index 8a81bbe..7db6476 100644
--- a/framework/private/test/service_registry_test.cpp
+++ b/framework/private/test/service_registry_test.cpp
@@ -222,7 +222,7 @@ TEST(service_registry, registerServiceFactoryNoProps) {
bundle_pt bundle = (bundle_pt) 0x10;
char * serviceName = my_strdup("service");
service_factory_pt factory = (service_factory_pt) malloc(sizeof(*factory));
- factory->factory = (void*) 0x20;
+ factory->handle = (void*) 0x20;
service_registration_pt reg = (service_registration_pt) 0x40;
mock()
[33/51] celix git commit: CELIX-77: fixed several memory issues
Posted by pn...@apache.org.
CELIX-77: fixed several memory issues
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5834d633
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5834d633
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5834d633
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 5834d633c1873477afab35c51c7109691c152fef
Parents: a10eef6
Author: Bjoern Petri <bp...@apache.org>
Authored: Thu Jan 14 18:39:29 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Thu Jan 14 18:39:29 2016 +0100
----------------------------------------------------------------------
.../config_admin_tst/config_admin_test.cpp | 4 +--
.../include/example_managed_service_impl.h | 3 +-
.../example_test/private/src/activator.c | 23 ++++++++--------
.../private/src/example_managed_service_impl.c | 10 +++++--
.../include/example2_managed_service_impl.h | 3 +-
.../example_test2/private/src/activator.c | 20 ++++++++------
.../private/src/example_managed_service_impl.c | 7 ++++-
.../include/configuration_admin_factory.h | 2 +-
.../private/include/configuration_admin_impl.h | 2 +-
.../private/include/configuration_impl.h | 2 +-
.../private/include/configuration_store.h | 2 +-
.../service/private/include/framework_patch.h | 2 +-
.../private/include/managed_service_tracker.h | 2 +-
.../private/include/updated_thread_pool.h | 2 +-
config_admin/service/private/src/activator.c | 15 +++++++---
.../private/src/configuration_admin_factory.c | 5 +++-
.../private/src/configuration_admin_impl.c | 2 +-
.../service/private/src/configuration_impl.c | 14 ++++++----
.../service/private/src/configuration_store.c | 29 ++++++++++----------
.../service/private/src/managed_service_impl.c | 4 +--
.../private/src/managed_service_tracker.c | 4 ++-
.../service/private/src/updated_thread_pool.c | 6 ++--
.../service/public/include/configuration.h | 2 +-
.../public/include/configuration_admin.h | 2 +-
.../public/include/configuration_event.h | 2 +-
.../public/include/configuration_listener.h | 2 +-
.../public/include/configuration_plugin.h | 2 +-
.../service/public/include/managed_service.h | 4 +--
28 files changed, 105 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/config_admin_test.cpp
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config_admin_test.cpp b/config_admin/config_admin_tst/config_admin_test.cpp
index 8215f15..acb6359 100644
--- a/config_admin/config_admin_tst/config_admin_test.cpp
+++ b/config_admin/config_admin_tst/config_admin_test.cpp
@@ -17,10 +17,10 @@
*under the License.
*/
/*
- * array_list_test.cpp
+ * config_admin_test.cpp
*
* \date Sep 15, 2015
- * \author Menno van der Graaf & Alexander
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
#include <stdio.h>
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
index 6f94994..c34647f 100644
--- a/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
+++ b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
@@ -20,7 +20,7 @@
* example_managed_service_impl.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -61,6 +61,7 @@ typedef struct tst_service *tst_service_pt;
celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance);
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/activator.c b/config_admin/config_admin_tst/example_test/private/src/activator.c
index 4adfcaa..2507e4e 100644
--- a/config_admin/config_admin_tst/example_test/private/src/activator.c
+++ b/config_admin/config_admin_tst/example_test/private/src/activator.c
@@ -20,7 +20,7 @@
* activator.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -52,9 +52,8 @@ struct activator {
tst_service_pt tstServ;
service_registration_pt tstReg;
-// struct managed_service mgmServ;
service_registration_pt mgmReg;
- managed_service_pt mgmServ;
+ managed_service_service_pt mgmServ;
service_reference_pt configAdminServRef;
configuration_admin_service_pt configAdminServ;
@@ -131,30 +130,31 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
act->configAdminServ = confAdminServ;
act->configAdminServRef = ref;
- status = managedServiceImpl_create(ctx, &act->mgmServ);
+ managed_service_pt managedService;
+ status = managedServiceImpl_create(ctx, &managedService);
if (status != CELIX_SUCCESS){
return status;
}
- struct test_managed_service *test_msp = (struct test_managed_service*)act->mgmServ;
+ struct test_managed_service *test_msp = (struct test_managed_service*) managedService;
test_msp->handle = act;
test_msp->store_props = store_properties;
- managed_service_service_pt managedService;
- status = managedService_create(ctx, &managedService);
+ status = managedService_create(ctx, &act->mgmServ);
+
if (status != CELIX_SUCCESS){
return status;
}
- managedService->managedService = act->mgmServ;
- managedService->updated = managedServiceImpl_updated;
+ act->mgmServ->managedService = managedService;
+ act->mgmServ->updated = managedServiceImpl_updated;
+
configuration->configuration_getProperties(configuration->handle, &dictionary);
if (dictionary == NULL) {
dictionary = properties_create();
properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
properties_set(dictionary, (char *) "type", (char*)"default_value");
}
- status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
- managedService, dictionary, &act->mgmReg);
+ status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME, act->mgmServ, dictionary, &act->mgmReg);
if (status != CELIX_SUCCESS){
printf("[ ERROR ]: Managed Service not registered \n");
return status;
@@ -186,6 +186,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
struct activator *act = (struct activator *)userData;
+ managedServiceImpl_destroy(&act->mgmServ->managedService);
managedService_destroy(act->mgmServ);
free(act->tstServ);
free(act);
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
index 02d5df5..309cc7a 100644
--- a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
+++ b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
@@ -20,7 +20,7 @@
* example_managed_service_impl.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -32,7 +32,7 @@
/* ------------------------ Constructor -------------------------------------*/
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance){
+celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance) {
celix_status_t status = CELIX_SUCCESS;
@@ -52,6 +52,12 @@ celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_serv
}
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance) {
+ free(*instance);
+
+ return CELIX_SUCCESS;
+}
+
/* -------------------- Implementation --------------------------------------*/
celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt properties){
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
index 8292721..ab63215 100644
--- a/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
+++ b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
@@ -20,7 +20,7 @@
* example_managed_service_impl.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -59,6 +59,7 @@ typedef struct tst2_service *tst2_service_pt;
celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance);
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test2/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/activator.c b/config_admin/config_admin_tst/example_test2/private/src/activator.c
index 400c63c..a5ff343 100644
--- a/config_admin/config_admin_tst/example_test2/private/src/activator.c
+++ b/config_admin/config_admin_tst/example_test2/private/src/activator.c
@@ -20,7 +20,7 @@
* activator.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -53,7 +53,8 @@ struct activator {
service_registration_pt tstReg;
service_registration_pt mgmReg;
- managed_service_pt mgmServ;
+ managed_service_service_pt mgmServ;
+
service_reference_pt configAdminServRef;
configuration_admin_service_pt configAdminServ;
@@ -124,19 +125,19 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
act->configAdminServ = confAdminServ;
act->configAdminServRef = ref;
- status = managedServiceImpl_create(ctx, &act->mgmServ);
+ managed_service_pt managedService;
+ status = managedServiceImpl_create(ctx, &managedService);
if (status != CELIX_SUCCESS){
return status;
}
- managed_service_service_pt managedService;
- status = managedService_create(ctx, &managedService);
+ status = managedService_create(ctx, &act->mgmServ);
if (status != CELIX_SUCCESS){
return status;
}
- managedService->managedService = act->mgmServ;
- managedService->updated = managedServiceImpl_updated;
+ act->mgmServ->managedService = managedService;
+ act->mgmServ->updated = managedServiceImpl_updated;
properties_pt dictionary;
dictionary = properties_create();
@@ -144,7 +145,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt ctx) {
properties_set(dictionary, (char *) "type", (char*)"test2_default_value");
status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
- managedService, dictionary, &act->mgmReg);
+ act->mgmServ, dictionary, &act->mgmReg);
if (status != CELIX_SUCCESS){
printf("[ ERROR ]: Managed Service not registered \n");
return status;
@@ -206,7 +207,8 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
struct activator *act = (struct activator *)userData;
- managedService_destroy(act->mgmServ);
+ managedServiceImpl_destroy(&act->mgmServ->managedService);
+ managedService_destroy(act->mgmServ);
free(act->tstServ);
free(act);
return CELIX_SUCCESS;
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
index 270e705..249bc66 100644
--- a/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
+++ b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
@@ -20,7 +20,7 @@
* example_managed_service_impl.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -60,6 +60,11 @@ celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_serv
return status;
}
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance) {
+ free(*instance);
+
+ return CELIX_SUCCESS;
+}
/* -------------------- Implementation --------------------------------------*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_admin_factory.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_admin_factory.h b/config_admin/service/private/include/configuration_admin_factory.h
index d86ea78..a7c79d8 100644
--- a/config_admin/service/private/include/configuration_admin_factory.h
+++ b/config_admin/service/private/include/configuration_admin_factory.h
@@ -20,7 +20,7 @@
* configuration_admin_factory.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_admin_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_admin_impl.h b/config_admin/service/private/include/configuration_admin_impl.h
index 08932ed..be79602 100644
--- a/config_admin/service/private/include/configuration_admin_impl.h
+++ b/config_admin/service/private/include/configuration_admin_impl.h
@@ -20,7 +20,7 @@
* configuration_admin_impl.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_impl.h b/config_admin/service/private/include/configuration_impl.h
index 71a488c..e8a0acd 100644
--- a/config_admin/service/private/include/configuration_impl.h
+++ b/config_admin/service/private/include/configuration_impl.h
@@ -20,7 +20,7 @@
* configuration_impl.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_store.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_store.h b/config_admin/service/private/include/configuration_store.h
index e5f9a8c..824ff63 100644
--- a/config_admin/service/private/include/configuration_store.h
+++ b/config_admin/service/private/include/configuration_store.h
@@ -20,7 +20,7 @@
* configuration_store.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/framework_patch.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/framework_patch.h b/config_admin/service/private/include/framework_patch.h
index 13ffeae..32200b5 100644
--- a/config_admin/service/private/include/framework_patch.h
+++ b/config_admin/service/private/include/framework_patch.h
@@ -20,7 +20,7 @@
* framework_patch.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/managed_service_tracker.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/managed_service_tracker.h b/config_admin/service/private/include/managed_service_tracker.h
index c29ea6a..9ce4516 100644
--- a/config_admin/service/private/include/managed_service_tracker.h
+++ b/config_admin/service/private/include/managed_service_tracker.h
@@ -20,7 +20,7 @@
* managed_service_tracker.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/updated_thread_pool.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/updated_thread_pool.h b/config_admin/service/private/include/updated_thread_pool.h
index 3dac3a2..ce1e6b6 100644
--- a/config_admin/service/private/include/updated_thread_pool.h
+++ b/config_admin/service/private/include/updated_thread_pool.h
@@ -20,7 +20,7 @@
* updated_thread_pool.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/activator.c b/config_admin/service/private/src/activator.c
index 0cc432c..2f94efa 100644
--- a/config_admin/service/private/src/activator.c
+++ b/config_admin/service/private/src/activator.c
@@ -20,7 +20,7 @@
* activator.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -44,6 +44,7 @@
struct config_admin_bundle {
bundle_context_pt context;
service_registration_pt configAdminFactoryReg;
+ service_factory_pt configAdminFactory;
configuration_admin_factory_pt configAdminFactoryInstance;
};
@@ -81,14 +82,13 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
config_admin_bundle_t bi = (config_admin_bundle_t) userData;
- service_factory_pt configAdminFactory;
- status = configurationAdminFactory_create(bi->context, &configAdminFactory, &bi->configAdminFactoryInstance);
+ status = configurationAdminFactory_create(bi->context, &bi->configAdminFactory, &bi->configAdminFactoryInstance);
if (status != CELIX_SUCCESS){
return status;
}
- status = bundleContext_registerServiceFactory(bi->context, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, configAdminFactory, NULL, &bi->configAdminFactoryReg);
+ status = bundleContext_registerServiceFactory(bi->context, (char *) CONFIGURATION_ADMIN_SERVICE_NAME, bi->configAdminFactory, NULL, &bi->configAdminFactoryReg);
if (status != CELIX_SUCCESS){
return status;
}
@@ -113,11 +113,18 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
configurationAdminFactory_destroy(context, bi->configAdminFactoryInstance);
bi->configAdminFactoryReg = NULL;
+ free(bi->configAdminFactory);
+
return status;
}
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+
+ config_admin_bundle_t bi = (config_admin_bundle_t) userData;
+
+ free(bi);
+
return CELIX_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_admin_factory.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_factory.c b/config_admin/service/private/src/configuration_admin_factory.c
index 99afbc0..1c821ea 100644
--- a/config_admin/service/private/src/configuration_admin_factory.c
+++ b/config_admin/service/private/src/configuration_admin_factory.c
@@ -20,7 +20,7 @@
* configuration_admin_factory.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -149,6 +149,9 @@ celix_status_t configurationAdminFactory_getService(void *handle, bundle_pt bund
celix_status_t configurationAdminFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt registration, void **service){
// do nothing
+
+ free(*service);
+
return CELIX_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_admin_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_impl.c b/config_admin/service/private/src/configuration_admin_impl.c
index 5bda485..eb8cb06 100644
--- a/config_admin/service/private/src/configuration_admin_impl.c
+++ b/config_admin/service/private/src/configuration_admin_impl.c
@@ -20,7 +20,7 @@
* configuration_admin_impl.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_impl.c b/config_admin/service/private/src/configuration_impl.c
index 9462a9a..f39dfa0 100644
--- a/config_admin/service/private/src/configuration_impl.c
+++ b/config_admin/service/private/src/configuration_impl.c
@@ -20,7 +20,7 @@
* configuration_impl.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -635,7 +635,9 @@ celix_status_t configuration_setAutoProperties(configuration_impl_pt configurati
configuration_lock(configuration);
// (2) set service.pid
- properties_set(*properties, (char*)OSGI_FRAMEWORK_SERVICE_PID, configuration->pid);
+ if (properties_get(*properties, (char*)OSGI_FRAMEWORK_SERVICE_PID) != NULL) {
+ properties_set(*properties, (char*)OSGI_FRAMEWORK_SERVICE_PID, configuration->pid);
+ }
// (3) set factory.pid
if ( configuration->factoryPid != NULL ){
@@ -660,17 +662,17 @@ celix_status_t configuration_setAutoProperties(configuration_impl_pt configurati
celix_status_t configuration_setBundleLocationProperty(configuration_impl_pt configuration, properties_pt *properties){
- char *boundLocation;
+ char *bundleLocation;
configuration_lock(configuration);
- if( configuration_getBundleLocation(configuration, &boundLocation) != CELIX_SUCCESS ){
+ if( configuration_getBundleLocation(configuration, &bundleLocation) != CELIX_SUCCESS ){
configuration_unlock(configuration);
return CELIX_ILLEGAL_ARGUMENT;
}
- if ( boundLocation != NULL ){
- properties_set(*properties, (char*)SERVICE_BUNDLELOCATION, boundLocation);
+ if ( bundleLocation != NULL ) {
+ properties_set(*properties, (char*)SERVICE_BUNDLELOCATION, bundleLocation);
}
configuration_unlock(configuration);
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_store.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_store.c b/config_admin/service/private/src/configuration_store.c
index 1343568..cee51e5 100644
--- a/config_admin/service/private/src/configuration_store.c
+++ b/config_admin/service/private/src/configuration_store.c
@@ -20,7 +20,7 @@
* configuration_store.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -151,6 +151,7 @@ celix_status_t configurationStore_saveConfiguration(configuration_store_pt store
//(5) configStore.writeFile(file,properties)
status = configurationStore_writeConfigurationFile(configFile, configProperties);
+
if (status != CELIX_SUCCESS) {
return status;
}
@@ -247,17 +248,17 @@ celix_status_t configurationStore_writeConfigurationFile(int file, properties_pt
}
// size >0
- char buffer[128];
+ char buffer[256];
hash_map_iterator_pt iterator = hashMapIterator_create(properties);
while (hashMapIterator_hasNext(iterator)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
- strcpy(buffer, hashMapEntry_getKey(entry));
- strcat(buffer, "=");
- strcat(buffer, hashMapEntry_getValue(entry));
- strcat(buffer, "\n");
+ char* key = hashMapEntry_getKey(entry);
+ char* val = hashMapEntry_getValue(entry);
+
+ snprintf(buffer, 256, "%s=%s", key, val);
int buffLength = strlen((const char *) buffer);
@@ -333,7 +334,7 @@ celix_status_t configurationStore_readCache(configuration_store_pt store) {
celix_status_t configurationStore_readConfigurationFile(const char *name, int size, properties_pt *dictionary) {
- char *fname; // file name
+ char fname[256]; // file name
char *buffer; // file buffer
int fd;
celix_status_t status = CELIX_SUCCESS;
@@ -341,9 +342,7 @@ celix_status_t configurationStore_readConfigurationFile(const char *name, int si
properties_pt properties = NULL;
// (1) The full path to the file
- fname = strdup((const char *) STORE_DIR);
- strcat(fname, strdup("/"));
- strcat(fname, strdup(name));
+ snprintf(fname, 256, "%s/%s", STORE_DIR, name);
// (2) pool.new
@@ -355,7 +354,7 @@ celix_status_t configurationStore_readConfigurationFile(const char *name, int si
}
// (4) buffer.new
- buffer = calloc(1, size);
+ buffer = calloc(1, size+1);
if (!buffer) {
close(fd);
return CELIX_ENOMEM;
@@ -382,26 +381,28 @@ celix_status_t configurationStore_parseDataConfigurationFile(char *data, propert
properties_pt properties = properties_create();
+
char *token;
char *key;
char *value;
+ char *saveptr;
bool isKey = true;
- token = strtok(data, "=");
+ token = strtok_r(data, "=", &saveptr);
while (token != NULL) {
if (isKey) {
key = strdup(token);
isKey = false;
+
} else { // isValue
value = strdup(token);
properties_set(properties, key, value);
isKey = true;
}
- token = strtok(NULL, "=\n");
-
+ token = strtok_r(NULL, "=\n", &saveptr);
}
if (hashMap_isEmpty(properties)) {
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_impl.c b/config_admin/service/private/src/managed_service_impl.c
index 243a57e..3909979 100644
--- a/config_admin/service/private/src/managed_service_impl.c
+++ b/config_admin/service/private/src/managed_service_impl.c
@@ -20,7 +20,7 @@
* managed_service_impl.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -49,7 +49,7 @@ celix_status_t managedService_create(bundle_context_pt context, managed_service_
}
-celix_status_t managedService_destroy(managed_service_pt service) {
+celix_status_t managedService_destroy(managed_service_service_pt service) {
free(service);
return CELIX_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/managed_service_tracker.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_tracker.c b/config_admin/service/private/src/managed_service_tracker.c
index 0e47ec0..642f1aa 100644
--- a/config_admin/service/private/src/managed_service_tracker.c
+++ b/config_admin/service/private/src/managed_service_tracker.c
@@ -20,7 +20,7 @@
* managed_service_tracker.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -182,6 +182,8 @@ celix_status_t managedServiceTracker_destroy(bundle_context_pt context, managed_
updatedThreadPool_destroy(mgServTr->updatedThreadPool);
celixThreadMutex_destroy(&mgServTr->managedServicesReferencesMutex);
serviceTracker_destroy(tracker);
+ free(mgServTr);
+
return CELIX_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/updated_thread_pool.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/updated_thread_pool.c b/config_admin/service/private/src/updated_thread_pool.c
index 922bd26..86220db 100644
--- a/config_admin/service/private/src/updated_thread_pool.c
+++ b/config_admin/service/private/src/updated_thread_pool.c
@@ -20,7 +20,7 @@
* updated_thread_pool.c
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -123,14 +123,16 @@ void *updateThreadPool_updatedCallback(void *data) {
(*managedServiceService->updated)(managedServiceService->managedService, properties);
+ free(data);
+
return NULL;
}
celix_status_t updatedThreadPool_wrapDataCallback(managed_service_service_pt service, properties_pt properties, data_callback_t *data){
-
*data = calloc(1, sizeof(**data));
+
if (!*data){
printf("[ ERROR ]: UpdatedThreadPool - WrapDataCallback (Data not initialized) \n");
return CELIX_ENOMEM;
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration.h b/config_admin/service/public/include/configuration.h
index f25af23..74bf5b1 100644
--- a/config_admin/service/public/include/configuration.h
+++ b/config_admin/service/public/include/configuration.h
@@ -20,7 +20,7 @@
* configuration.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_admin.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_admin.h b/config_admin/service/public/include/configuration_admin.h
index 09ad096..0a8983c 100644
--- a/config_admin/service/public/include/configuration_admin.h
+++ b/config_admin/service/public/include/configuration_admin.h
@@ -20,7 +20,7 @@
* configuration_admin.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_event.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_event.h b/config_admin/service/public/include/configuration_event.h
index 38b79d1..3fbae52 100644
--- a/config_admin/service/public/include/configuration_event.h
+++ b/config_admin/service/public/include/configuration_event.h
@@ -20,7 +20,7 @@
* configuration_event.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_listener.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_listener.h b/config_admin/service/public/include/configuration_listener.h
index 3a635e6..a25a70d 100644
--- a/config_admin/service/public/include/configuration_listener.h
+++ b/config_admin/service/public/include/configuration_listener.h
@@ -20,7 +20,7 @@
* configuration_listener.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_plugin.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_plugin.h b/config_admin/service/public/include/configuration_plugin.h
index 2175104..d523326 100644
--- a/config_admin/service/public/include/configuration_plugin.h
+++ b/config_admin/service/public/include/configuration_plugin.h
@@ -20,7 +20,7 @@
* configuration_plugin.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/managed_service.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/managed_service.h b/config_admin/service/public/include/managed_service.h
index b666e51..1067760 100644
--- a/config_admin/service/public/include/managed_service.h
+++ b/config_admin/service/public/include/managed_service.h
@@ -20,7 +20,7 @@
* managed_service.h
*
* \date Aug 12, 2013
- * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
@@ -49,6 +49,6 @@ struct managed_service_service{
};
celix_status_t managedService_create(bundle_context_pt context, managed_service_service_pt *service);
-celix_status_t managedService_destroy(managed_service_pt service);
+celix_status_t managedService_destroy(managed_service_service_pt service);
#endif /* MANAGED_SERVICE_H_ */
[51/51] celix git commit: Merge branch 'develop' into
feature/CELIX-335_deploy_refactoring
Posted by pn...@apache.org.
Merge branch 'develop' into feature/CELIX-335_deploy_refactoring
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/a43d78b3
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/a43d78b3
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/a43d78b3
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: a43d78b30e012b03956db398bccd79e71a53739d
Parents: cd1f749 2eac60e
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Mon Jan 25 19:00:29 2016 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Mon Jan 25 19:00:29 2016 +0100
----------------------------------------------------------------------
.travis.yml | 94 ++--
BUILDING | 17 +-
CMakeLists.txt | 6 +-
Dockerfile.Android | 119 +++++
README.md | 2 +-
cmake/cmake_celix/Config.cmake.in | 4 +
config_admin/CMakeLists.txt | 25 +-
config_admin/config_admin_tst/CMakeLists.txt | 47 ++
.../config_admin_tst/config.properties.in | 20 +
.../config_admin_tst/config_admin_test.cpp | 404 +++++++++++++++
.../example_test/CMakeLists.txt | 31 ++
.../example_test/META-INF/MANIFEST.MF | 5 +
.../include/example_managed_service_impl.h | 68 +++
.../example_test/private/src/activator.c | 206 ++++++++
.../private/src/example_managed_service_impl.c | 103 ++++
.../example_test2/CMakeLists.txt | 30 ++
.../example_test2/META-INF/MANIFEST.MF | 5 +
.../include/example2_managed_service_impl.h | 66 +++
.../example_test2/private/src/activator.c | 227 ++++++++
.../private/src/example_managed_service_impl.c | 108 ++++
config_admin/examples/CMakeLists.txt | 21 -
.../examples/example_test/CMakeLists.txt | 31 --
.../examples/example_test/META-INF/MANIFEST.MF | 5 -
.../include/example_managed_service_impl.h | 53 --
.../example_test/private/src/activator.c | 188 -------
.../private/src/example_managed_service_impl.c | 94 ----
.../examples/example_test2/CMakeLists.txt | 21 -
.../bundle_configuring/CMakeLists.txt | 28 -
.../bundle_configuring/META-INF/MANIFEST.MF | 5 -
.../bundle_configuring/private/src/activator.c | 94 ----
.../bundle_managed_service/CMakeLists.txt | 30 --
.../bundle_managed_service/META-INF/MANIFEST.MF | 5 -
.../include/example_managed_service_impl.h | 55 --
.../private/src/activator.c | 120 -----
.../private/src/example_managed_service_impl.c | 95 ----
config_admin/readme.md | 29 ++
.../include/configuration_admin_factory.h | 4 +-
.../private/include/configuration_admin_impl.h | 3 +-
.../private/include/configuration_impl.h | 38 +-
.../private/include/configuration_store.h | 3 +-
.../service/private/include/framework_patch.h | 2 +-
.../private/include/managed_service_tracker.h | 11 +-
.../private/include/updated_thread_pool.h | 10 +-
config_admin/service/private/src/activator.c | 23 +-
.../private/src/configuration_admin_factory.c | 42 +-
.../private/src/configuration_admin_impl.c | 19 +-
.../service/private/src/configuration_impl.c | 327 +++++++-----
.../service/private/src/configuration_store.c | 98 ++--
.../service/private/src/managed_service_impl.c | 7 +-
.../private/src/managed_service_tracker.c | 174 ++++---
.../service/private/src/updated_thread_pool.c | 47 +-
.../service/public/include/configuration.h | 29 +-
.../public/include/configuration_admin.h | 2 +-
.../public/include/configuration_event.h | 2 +-
.../public/include/configuration_listener.h | 2 +-
.../public/include/configuration_plugin.h | 2 +-
.../service/public/include/managed_service.h | 4 +-
.../private/src/dm_service_dependency.c | 4 +
dfi/CMakeLists.txt | 2 +-
framework/CMakeLists.txt | 10 +-
framework/private/include/filter_private.h | 1 -
framework/private/mock/celix_log_mock.c | 54 ++
framework/private/src/filter.c | 212 +++++---
framework/private/src/service_registration.c | 4 +-
framework/private/src/service_registry.c | 8 +-
framework/private/test/filter_test.cpp | 514 ++++++++++++++++++-
.../private/test/service_registration_test.cpp | 8 +-
.../private/test/service_registry_test.cpp | 2 +-
framework/public/include/service_factory.h | 6 +-
log_service/private/src/log_factory.c | 4 +-
remote_services/discovery_etcd/README.md | 12 +
.../discovery_etcd/private/src/etcd.c | 3 +-
.../discovery_etcd/private/src/etcd_watcher.c | 45 +-
...apache.celix.calc.api.Calculator2.descriptor | 2 +-
.../examples/calculator_shell/CMakeLists.txt | 1 +
...apache.celix.calc.api.Calculator2.descriptor | 11 +
.../calculator_shell/private/src/add_command.c | 9 +-
.../calculator_shell/private/src/sqrt_command.c | 9 +-
.../calculator_shell/private/src/sub_command.c | 9 +-
remote_services/remote_service_admin/README.md | 10 +
.../private/include/import_registration_dfi.h | 2 +-
.../rsa/private/src/export_registration_dfi.c | 11 +-
.../rsa/private/src/import_registration_dfi.c | 52 +-
.../rsa/private/src/remote_service_admin_dfi.c | 13 +-
.../rsa_tst/rsa_tests.cpp | 1 +
.../private/test/CMakeLists.txt | 4 +-
remote_services/topology_manager/README.md | 6 +
.../private/src/topology_manager.c | 67 +--
.../topology_manager/tms_tst/tms_tests.cpp | 7 +-
shell/private/src/activator.c | 34 +-
shell/private/src/log_command.c | 5 +-
shell/private/src/shell.c | 126 ++---
shell_tui/CMakeLists.txt | 2 +
shell_tui/private/include/shell_tui.h | 51 ++
shell_tui/private/src/activator.c | 102 ++++
shell_tui/private/src/shell_tui.c | 197 +++----
utils/CMakeLists.txt | 14 +-
utils/private/src/version.c | 17 +
utils/private/test/version_test.cpp | 34 +-
utils/public/include/version.h | 18 +
100 files changed, 3346 insertions(+), 1667 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/CMakeLists.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/config_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --cc config_admin/CMakeLists.txt
index 81040db,3801e6e..6a8e08c
--- a/config_admin/CMakeLists.txt
+++ b/config_admin/CMakeLists.txt
@@@ -20,9 -20,29 +20,32 @@@ celix_subproject(CONFIG_ADMIN "Option t
if (CONFIG_ADMIN)
add_subdirectory(service)
- add_subdirectory(examples)
+ # add_subdirectory(examples)
+
+ if (ENABLE_TESTING)
+ find_package(CppUTest REQUIRED)
+
+ include_directories(${CPPUTEST_INCLUDE_DIR})
+ add_subdirectory(config_admin_tst)
+ # find_package(CppUTest REQUIRED)
+ #
+ # include_directories(${CUNIT_INCLUDE_DIRS})
+ # include_directories(${CPPUTEST_INCLUDE_DIR})
+ # include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+ # include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/private/include")
+ # include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+ #
+ # add_executable(config_admin_test config_admin_tst/config_admin_test.cpp)
+ # target_link_libraries(config_admin_test celix_utils ${CPPUTEST_LIBRARY} pthread)
+ #
+ #
+ # add_test(NAME run_config_admin_test COMMAND config_admin_test)
+ # SETUP_TARGET_FOR_COVERAGE(config_admin_test config_admin_test ${CMAKE_BINARY_DIR}/coverage/config_admin_test/config_admin_test)
+
+ endif(ENABLE_TESTING)
+
+ add_deploy("config_admin1" BUNDLES config_admin shell shell_tui log_service log_writer example_test)
+ add_deploy("config_admin2" BUNDLES config_admin shell shell_tui log_service log_writer bundle_managed_service bundle_configuring)
+
endif (CONFIG_ADMIN)
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/config_admin/config_admin_tst/example_test/CMakeLists.txt
----------------------------------------------------------------------
diff --cc config_admin/config_admin_tst/example_test/CMakeLists.txt
index 0000000,7782c0d..d4c4b3d
mode 000000,100644..100644
--- a/config_admin/config_admin_tst/example_test/CMakeLists.txt
+++ b/config_admin/config_admin_tst/example_test/CMakeLists.txt
@@@ -1,0 -1,32 +1,31 @@@
+ # 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.
+
+
+ include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+ include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+ include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+ include_directories("private/include")
+
-SET(BUNDLE_SYMBOLICNAME "example_test")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(example_test SOURCES
++add_bundle(example_test
++ VERSION 0.1.0
++ SOURCES
+ private/src/activator
+ private/src/example_managed_service_impl
+ )
+
+ target_link_libraries(example_test celix_framework celix_utils config_admin)
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/config_admin/config_admin_tst/example_test2/CMakeLists.txt
----------------------------------------------------------------------
diff --cc config_admin/config_admin_tst/example_test2/CMakeLists.txt
index 0000000,ddad504..2d38251
mode 000000,100644..100644
--- a/config_admin/config_admin_tst/example_test2/CMakeLists.txt
+++ b/config_admin/config_admin_tst/example_test2/CMakeLists.txt
@@@ -1,0 -1,32 +1,30 @@@
+ # 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.
+
+
+ include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+ include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
+ include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
+ include_directories("private/include")
+
-SET(BUNDLE_SYMBOLICNAME "example_test2")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(example_test2 SOURCES
++add_bundle(bundle_managed_service SOURCES
+ private/src/activator
+ private/src/example_managed_service_impl
++ VERSION 0.1.0
+ )
+
+ target_link_libraries(example_test2 celix_framework celix_utils config_admin)
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/dfi/CMakeLists.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/framework/CMakeLists.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/remote_services/examples/calculator_shell/CMakeLists.txt
----------------------------------------------------------------------
diff --cc remote_services/examples/calculator_shell/CMakeLists.txt
index e45f041,24a4d1e..361b688
--- a/remote_services/examples/calculator_shell/CMakeLists.txt
+++ b/remote_services/examples/calculator_shell/CMakeLists.txt
@@@ -29,14 -32,11 +29,15 @@@ add_bundle(calculator_shell SOURCE
private/include/add_command.h
private/include/sqrt_command.h
private/include/sub_command.h
+
+ VERSION 0.0.1
+ SYMBOLIC_NAME "apache_celix_remoting_calculator_shell"
+)
-
- FILES
- ../calculator_service/public/include/org.apache.celix.calc.api.Calculator2.descriptor
- #private/include/org.apache.celix.calc.api.Calculator2.descriptor ##Use this descriptor in case you want to try out versioning!
+bundle_files(calculator_shell
+ ../calculator_service/public/include/org.apache.celix.calc.api.Calculator2.descriptor
++ #private/include/org.apache.celix.calc.api.Calculator2.descriptor ##Use this descriptor in case you want to try out versioning!
+ DESTINATION .
)
target_link_libraries(calculator_shell celix_framework)
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/shell_tui/CMakeLists.txt
----------------------------------------------------------------------
diff --cc shell_tui/CMakeLists.txt
index a94b616,6690d46..9bcab15
--- a/shell_tui/CMakeLists.txt
+++ b/shell_tui/CMakeLists.txt
@@@ -17,11 -17,13 +17,12 @@@
celix_subproject(SHELL_TUI "Option to enable building the Shell Textual User Interface bundles" ON DEPS LAUNCHER SHELL)
if (SHELL_TUI)
- SET_HEADER(BUNDLE_VERSION "1.0.0")
- SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_shell_tui")
- SET_HEADERS("Bundle-Name: Apache Celix Shell TUI")
-
- bundle(shell_tui
- SOURCES
+ add_bundle(shell_tui
+ SYMBOLIC_NAME "apache_celix_shell_tui"
+ VERSION "1.0.0"
+ NAME "Apache Celix Shell TUI"
+ SOURCES
+ private/src/activator
private/src/shell_tui
)
http://git-wip-us.apache.org/repos/asf/celix/blob/a43d78b3/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --cc utils/CMakeLists.txt
index 8f6385c,77b1aa2..6c273bd
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@@ -54,11 -54,12 +54,14 @@@ if (UTILS
private/src/thpool.c
public/include/thpool.h
)
++
+ set_target_properties(celix_utils PROPERTIES "SOVERSION" 2)
-
- IF(UNIX)
+
+ IF(UNIX AND NOT ANDROID)
target_link_libraries(celix_utils m pthread)
- ENDIF(UNIX)
+ ELSEIF(ANDROID)
+ target_link_libraries(celix_utils m)
+ ENDIF()
install(TARGETS celix_utils DESTINATION lib COMPONENT framework)
FILE(GLOB files "public/include/*.h")
[48/51] celix git commit: CELIX-247: travis adapt Dockerbuild
Posted by pn...@apache.org.
CELIX-247: travis adapt Dockerbuild
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/264be189
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/264be189
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/264be189
Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 264be1890c5d06a71b6d7150360563b456b54028
Parents: 8302c5f
Author: Bjoern Petri <bp...@apache.org>
Authored: Sun Jan 24 12:16:00 2016 +0100
Committer: Bjoern Petri <bp...@apache.org>
Committed: Sun Jan 24 12:16:00 2016 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/264be189/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 33c2c8e..5ed0841 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -83,7 +83,7 @@ script:
- if [ "$CC" = "gcc" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export BUILD_OPTS="${BUILD_OPTS} -DENABLE_CODE_COVERAGE=ON"; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ -z "$ANDROID" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_LINUX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake ${BUILD_OPTIONS} ${BUILD_OPTIONS_OSX} -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON -DENABLE_TESTING=ON -DFFI_LIBRARY=/usr/local/opt/libffi/lib/libffi.dylib ${BUILD_OPTS} -DCMAKE_INSTALL_PREFIX=../install ..; fi
- - if [ -z "$ANDROID" ]; then make all && make deploy && make install-all; else docker build -t celixandroid ..; fi
+ - if [ -z "$ANDROID" ]; then make all && make deploy && make install-all; else docker build -t celixandroid - < ../Dockerfile.Android ; fi
- if [ -z "$ANDROID" ]; then export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework:`pwd`/dfi && make test ARGS="-V"; else docker run celixandroid; fi
after_success: