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 2018/05/27 18:36:57 UTC
[14/51] [partial] celix git commit: CELIX-424: Cleans up the
directory structure. Moves all libraries to the libs subdir and all bundles
to the bundles subdir
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_admin/private/src/event_admin_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/private/src/event_admin_impl.c b/event_admin/event_admin/private/src/event_admin_impl.c
deleted file mode 100644
index a7eeb49..0000000
--- a/event_admin/event_admin/private/src/event_admin_impl.c
+++ /dev/null
@@ -1,212 +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.
- */
-/*
- * event_admin_impl.c
- *
- * Created on: Jul 24, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "event_admin.h"
-#include "event_admin_impl.h"
-#include "event_handler.h"
-#include "hash_map.h"
-#include "utils.h"
-#include "celix_log.h"
-
-
-celix_status_t eventAdmin_create(bundle_context_pt context, event_admin_pt *event_admin){
- celix_status_t status = CELIX_SUCCESS;
- *event_admin = calloc(1,sizeof(**event_admin));
- if (!*event_admin) {
- status = CELIX_ENOMEM;
- } else {
- (*event_admin)->channels = hashMap_create(utils_stringHash, utils_stringHash, utils_stringEquals, utils_stringEquals);
- (*event_admin)->context =context;
- status = arrayList_create(&(*event_admin)->event_handlers);
- }
- return status;
-}
-
-celix_status_t eventAdmin_destroy(event_admin_pt *event_admin)
-{
- celix_status_t status = CELIX_SUCCESS;
- //free(*event_admin);
- return status;
-}
-
-celix_status_t eventAdmin_getEventHandlersByChannel(bundle_context_pt context, const char * serviceName, array_list_pt *eventHandlers) {
- celix_status_t status = CELIX_SUCCESS;
- //celix_status_t status = bundleContext_getServiceReferences(context, serviceName, NULL, eventHandlers);
- return status;
-}
-
-celix_status_t eventAdmin_postEvent(event_admin_pt event_admin, event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
-
- const char *topic;
-
- eventAdmin_getTopic(&event, &topic);
-
- array_list_pt event_handlers;
- arrayList_create(&event_handlers);
- eventAdmin_lockHandlersList(event_admin, topic);
- eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
- // TODO make this async!
- array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
- while (arrayListIterator_hasNext(handlers_iterator)) {
- event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (POST EVENT) for %s", topic);
- event_handler_service->handle_event(&event_handler_service->event_handler, event);
- }
- eventAdmin_releaseHandersList(event_admin, topic);
- return status;
-}
-
-celix_status_t eventAdmin_sendEvent(event_admin_pt event_admin, event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
-
- const char *topic;
- eventAdmin_getTopic(&event, &topic);
-
- array_list_pt event_handlers;
- arrayList_create(&event_handlers);
- eventAdmin_lockHandlersList(event_admin, topic);
- eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
- array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
- while (arrayListIterator_hasNext(handlers_iterator)) {
- event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (SEND EVENT) for %s", topic);
- event_handler_service->handle_event(&event_handler_service->event_handler, event);
- }
- eventAdmin_releaseHandersList(event_admin, topic);
- return status;
-}
-
-celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, const char *topic,
- array_list_pt event_handlers) {
- celix_status_t status = CELIX_SUCCESS;
- hash_map_pt channels = event_admin->channels;
- channel_t channel = hashMap_get(channels, topic);
- if (channel != NULL) {
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "found channel: %s", topic);
- if (channel->eventHandlers != NULL && !hashMap_isEmpty(channel->eventHandlers)) {
- // iterate throught the handlers and add them to the array list for result.
- hash_map_iterator_pt hashmap_iterator = hashMapIterator_create(channel->eventHandlers);
- while (hashMapIterator_hasNext(hashmap_iterator)) {
- arrayList_add(event_handlers, (event_handler_service_pt) hashMapIterator_nextValue(hashmap_iterator));
- }
- }
- } else {
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_WARNING, "no such channel: %s", topic);
- }
- return status;
-}
-
-celix_status_t eventAdmin_createEventChannels(event_admin_pt *event_admin, const char *topic,
- event_handler_service_pt event_handler_service) {
- celix_status_t status = CELIX_SUCCESS;
- channel_t channel = hashMap_get((*event_admin)->channels, topic);
- if (channel == NULL) {
- //create channel
- logHelper_log(*(*event_admin)->loghelper, OSGI_LOGSERVICE_ERROR, "Creating channel: %s", topic);
-
-
-
- channel = calloc(1, sizeof(*channel));
- if (!channel) {
- status = CELIX_ENOMEM;
- } else {
- char *channel_name = strdup(topic);
- channel->topic = channel_name;
- channel->eventHandlers = hashMap_create(NULL,NULL,NULL,NULL);
- //channel->channelLock = NULL;
- // apr_thread_mutex_create(&channel->channelLock, APR_THREAD_MUTEX_NESTED, subPool);
- hashMap_put((*event_admin)->channels, channel_name, channel);
- }
- }
- if (channel) {
- hashMap_put(channel->eventHandlers, &event_handler_service, event_handler_service);
- }
- return status;
-
-
-}
-
-celix_status_t eventAdmin_lockHandlersList(event_admin_pt event_admin, const char *topic) {
- celix_status_t status = CELIX_SUCCESS;
- /*channel_t channel = hashMap_get(event_admin->channels, topic);
- if (channel != NULL) {
- // TODO verify this will never deadlock...
- // apr_status_t status;
- do {
- // status = apr_thread_mutex_trylock(channel->channelLock);
- } while (status != 0 && !APR_STATUS_IS_EBUSY(status));
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "LOCK: %s!", topic);
- }*/
- return status;
-}
-
-celix_status_t eventAdmin_releaseHandersList(event_admin_pt event_admin, const char *topic) {
- celix_status_t status = CELIX_SUCCESS;
- channel_t channel = hashMap_get(event_admin->channels, topic);
- if (channel != NULL) {
- // TODO check the result value...
- // apr_thread_mutex_unlock(channel->channelLock);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "UNLOCK: %s!", topic);
- }
- return status;
-}
-
-celix_status_t eventAdmin_addingService(void * handle, service_reference_pt ref, void **service) {
- celix_status_t status = CELIX_SUCCESS;
- event_admin_pt event_admin = handle;
- status = bundleContext_getService(event_admin->context, ref, service);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "test");
- printf("eventadmin adding service \n");
- return status;
-}
-
-celix_status_t eventAdmin_addedService(void * handle, service_reference_pt ref, void * service) {
- celix_status_t status = CELIX_SUCCESS;
- event_admin_pt event_admin = handle;
- event_handler_service_pt event_handler_service = NULL;
- event_handler_service = (event_handler_service_pt) service;
- const char *topic = NULL;
- serviceReference_getProperty(ref, (char*)EVENT_TOPIC, &topic);
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Original TOPIC: %s", topic);
- printf("original topic: %s\n", topic);
- eventAdmin_createEventChannels(&event_admin,topic,event_handler_service);
- return status;
-}
-
-celix_status_t eventAdmin_modifiedService(void * handle, service_reference_pt ref, void * service) {
- event_admin_pt event_admin = (event_admin_pt) handle;
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Modified");
- return CELIX_SUCCESS;
-}
-
-celix_status_t eventAdmin_removedService(void * handle, service_reference_pt ref, void * service) {
- event_admin_pt event_admin = (event_admin_pt) handle;
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "Event admin Removed %p", service);
- printf("Event admin Removed %p", service);
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_admin/private/src/event_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/private/src/event_impl.c b/event_admin/event_admin/private/src/event_impl.c
deleted file mode 100644
index aad9877..0000000
--- a/event_admin/event_admin/private/src/event_impl.c
+++ /dev/null
@@ -1,136 +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.
- */
-/*
- * event_impl.c
- *
- * \Created on: Aug 22, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- *
- */
-#include <stdlib.h>
-
-#include "event_admin.h"
-#include "event_admin_impl.h"
-#include "event_constants.h"
-#include "celix_errno.h"
-#include "stddef.h"
-
-
-
-celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, const char *topic, properties_pt properties,
- event_pt *event) {
- celix_status_t status = CELIX_SUCCESS;
-
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "create event event admin pointer: %p",event_admin);
-
-
- *event = calloc(1, sizeof(**event));
- if(!*event){
- status = CELIX_ENOMEM;
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "No MEM");
- }else {
- logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "Event created : %s", topic);
- (*event)->topic = topic;
- (*event)->properties = properties;
- properties_set((*event)->properties, (char *)EVENT_TOPIC, topic);
- }
- return status;
-}
-
-celix_status_t eventAdmin_containsProperty( event_pt *event, char *property, bool *result){
- celix_status_t status = CELIX_SUCCESS;
- if((*event)==NULL || property == NULL){
- status = CELIX_BUNDLE_EXCEPTION;
- }else {
- const char *propertyValue = properties_get((*event)->properties, property);
- if(propertyValue == NULL){
- (*result)= false;
- }else {
- (*result) = true;
- }
- }
- return status;
-}
-
-celix_status_t eventAdmin_event_equals( event_pt *event, event_pt *compare, bool *result){
- celix_status_t status = CELIX_SUCCESS;
- if(event == compare){
- (*result) = true;
- }else {
- int sizeofEvent = hashMap_size((*event)->properties);
- int sizeofCompare = hashMap_size((*compare)->properties);
- if(sizeofEvent == sizeofCompare){
- (*result) = true;
- }else {
-
- }
- }
- return status;
-}
-
-celix_status_t eventAdmin_getProperty(event_pt *event, char *propertyKey, const char **propertyValue) {
- celix_status_t status = CELIX_SUCCESS;
- *propertyValue = properties_get((*event)->properties,propertyKey);
-
- return status;
-}
-
-celix_status_t eventAdmin_getPropertyNames( event_pt *event, array_list_pt *names){
- celix_status_t status = CELIX_SUCCESS;
- properties_pt properties = (*event)->properties;
- if (hashMap_size(properties) > 0) {
- hash_map_iterator_pt iterator = hashMapIterator_create(properties);
- while (hashMapIterator_hasNext(iterator)) {
- hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
- char * key =hashMapEntry_getKey(entry);
- arrayList_add((*names),key);
- }
- }
- return status;
-}
-
-celix_status_t eventAdmin_getTopic(event_pt *event, const char **topic) {
- celix_status_t status = CELIX_SUCCESS;
- const char *value;
- value = properties_get((*event)->properties,(char*) EVENT_TOPIC);
- *topic = value;
-
- return status;
-}
-
-celix_status_t eventAdmin_hashCode( event_pt *event, int *hashCode){
- celix_status_t status = CELIX_SUCCESS;
- return status;
-}
-
-celix_status_t eventAdmin_matches( event_pt *event){
- celix_status_t status = CELIX_SUCCESS;
- return status;
-}
-
-celix_status_t eventAdmin_toString( event_pt *event, char *eventString){
- celix_status_t status = CELIX_SUCCESS;
- return status;
-}
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_admin/public/include/event_admin.h
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/public/include/event_admin.h b/event_admin/event_admin/public/include/event_admin.h
deleted file mode 100644
index 4955b54..0000000
--- a/event_admin/event_admin/public/include/event_admin.h
+++ /dev/null
@@ -1,70 +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.
- */
-/*
- * event_admin.h
- *
- * Created on: Jul 9, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef EVENT_ADMIN_H_
-#define EVENT_ADMIN_H_
-#include "celix_errno.h"
-
-#include "listener_hook_service.h"
-
-#define EVENT_ADMIN_NAME "event_admin"
-typedef struct event_admin *event_admin_pt;
-typedef struct event_admin_service *event_admin_service_pt;
-
-struct event {
- const char *topic;
- properties_pt properties;
-};
-typedef struct event *event_pt;
-
-/**
- * @desc service description for the event admin.
- * @param event_admin_pt eventAdmin. incomplete type for the event admin instance.
- * @param celix_status_t postEvent. Pointer to the post event function. For async sending
- * @param celix_status_t sendEvent. Pointer to the send event function. for Sync sending
- */
-struct event_admin_service {
- event_admin_pt eventAdmin;
- celix_status_t (*postEvent)(event_admin_pt event_admin, event_pt event);
- celix_status_t (*sendEvent)(event_admin_pt event_admin, event_pt event);
-
- celix_status_t (*createEvent)(event_admin_pt event_admin, const char *topic, properties_pt properties,
- event_pt *event);
- celix_status_t (*containsProperty)(event_pt *event, char *property, bool *result);
- celix_status_t (*event_equals)(event_pt *event, event_pt *compare, bool *result);
-
- celix_status_t (*getProperty)(event_pt *event, char *propertyKey, const char **propertyValue);
- celix_status_t (*getPropertyNames)(event_pt *event, array_list_pt *names);
-
- celix_status_t (*getTopic)(event_pt *event, const char **topic);
- celix_status_t (*hashCode)(event_pt *event, int *hashCode);
- celix_status_t (*matches)( event_pt *event);
- celix_status_t (*toString)( event_pt *event, char *eventString);
-
-};
-
-
-#endif /* EVENT_ADMIN_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_admin/public/include/event_constants.h
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/public/include/event_constants.h b/event_admin/event_admin/public/include/event_constants.h
deleted file mode 100644
index 80b093a..0000000
--- a/event_admin/event_admin/public/include/event_constants.h
+++ /dev/null
@@ -1,60 +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.
- */
-/*
- * event_constants.h
- *
- * Created on: Aug 11, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef EVENT_CONSTANTS_H_
-#define EVENT_CONSTANTS_H_
-
-static const char * const EVENT_BUNDLE = "bundle";
-static const char * const EVENT_BUNDLE_ID = "bundle.id";
-static const char * const EVENT_BUNDLE_SIGNER = "bundle.signer";
-
-static const char * const EVENT_BUNDLE_SYMBOLICNAME = "bundle.symbolicName";
-
-
-static const char * const EVENT_BUNDLE_VERSION = "bundle.version";
-
-static const char * const EVENT_DELIVERY_ASYNC_ORDERED = "async.ordered";
-static const char * const EVENT_DELIVERY_ASYNC_UNORDERED = "async.unordered";
-static const char * const EVENT = "event";
-static const char * const EVENT_DELIVERY = "event.delivery";
-static const char * const EVENT_FILTER = "event.filter";
-static const char * const EVENT_TOPIC = "event.topic";
-static const char * const EVENT_EXCEPTION = "exception";
-static const char * const EVENT_EXCEPTION_CLASS = "exception.class";
-static const char * const EVENT_EXCEPTION_MESSAGE = "exception.message";
-static const char * const MESSAGE = "message";
-
-static const char * const EVENT_SERVICE = "service";
-
-static const char * const EVENT_SERVICE_ID = "async.ordered";
-
-static const char * const EVENT_SERVICE_OBJECTCLASS = "service.objectClass";
-
-static const char * const EVENT_SERVICE_PID = "service.pid";
-
-static const char * const EVENT_TIMESTAMP = "timestamp";
-
-#endif /* EVENT_CONSTANTS_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_admin/public/include/event_handler.h
----------------------------------------------------------------------
diff --git a/event_admin/event_admin/public/include/event_handler.h b/event_admin/event_admin/public/include/event_handler.h
deleted file mode 100644
index 5f76c6d..0000000
--- a/event_admin/event_admin/public/include/event_handler.h
+++ /dev/null
@@ -1,48 +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.
- */
-/*
- * event_handler.h
- *
- * Created on: Jul 22, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef EVENT_HANDLER_H_
-#define EVENT_HANDLER_H_
-#include "event_admin.h"
-#include "properties.h"
-static const char * const EVENT_HANDLER_SERVICE = "service.event.handler";
-
-typedef struct event_handler_service *event_handler_service_pt;
-typedef struct event_handler *event_handler_pt; //ADT
-
-
-
-/**
- * @desc description of the event handler service
- * @param event_handler_pt event_handler incomplete type pointer for the event_handler instance
- * @param celix_status_t handle event. pointer to the handle event method.
- */
-struct event_handler_service {
- event_handler_pt event_handler;
- celix_status_t (*handle_event)(event_handler_pt *event_handler, event_pt event);
-};
-
-#endif /* EVENT_HANDLER_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_handler/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/event_admin/event_handler/CMakeLists.txt b/event_admin/event_handler/CMakeLists.txt
deleted file mode 100644
index 92813a7..0000000
--- a/event_admin/event_handler/CMakeLists.txt
+++ /dev/null
@@ -1,35 +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(private/include)
-include_directories(${PROJECT_SOURCE_DIR}/event_admin/event_admin/public/include)
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-
-
-add_celix_bundle(event_handler
- VERSION 0.0.0
- SOURCES
- private/src/event_handler_activator.c
- private/src/event_handler_impl.c
- ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
-)
-
-install_celix_bundle(event_handler)
-
-target_link_libraries(event_handler Celix::framework)
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_handler/private/include/event_handler_impl.h
----------------------------------------------------------------------
diff --git a/event_admin/event_handler/private/include/event_handler_impl.h b/event_admin/event_handler/private/include/event_handler_impl.h
deleted file mode 100644
index 44fc671..0000000
--- a/event_admin/event_handler/private/include/event_handler_impl.h
+++ /dev/null
@@ -1,57 +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.
- */
-/*
- * event_handler_impl.h
- *
- * Created on: Aug 20, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef EVENT_HANDLER_IMPL_H_
-#define EVENT_HANDLER_IMPL_H_
-#include "event_admin.h"
-#include "event_constants.h"
-#include "event_handler.h"
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_tracker.h"
-#include "service_listener.h"
-#include "service_registration.h"
-#include "listener_hook_service.h"
-#include "event_constants.h"
-/**
- * @desc handle the event send to the event handler
- * @param event_handler_pt *instance the instance of the event handlers
- * @param event_pt event. the event to be handled.
- */
-celix_status_t eventHandlerHandleEvent(event_handler_pt *instance, event_pt event) ;
-
-/**
- * @desc create the event handler
- * @param apr_pool_t *pool the apr pool to contain the handler
- * @param event_handler_pt *event_handler. the event handler to be made.
- */
-celix_status_t eventHandlerCreate(bundle_context_pt context, event_handler_pt *event_handler);
-celix_status_t eventHandlerRemovedService(void * handle, service_reference_pt ref, void * service) ;
-celix_status_t eventHandlerModifiedService(void * handle, service_reference_pt ref, void * service) ;
-celix_status_t eventHandlerAddedService(void * handle, service_reference_pt ref, void * service) ;
-celix_status_t eventHandlerAddingService(void * handle, service_reference_pt ref, void **service) ;
-#endif /* EVENT_HANDLER_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_handler/private/src/event_handler_activator.c
----------------------------------------------------------------------
diff --git a/event_admin/event_handler/private/src/event_handler_activator.c b/event_admin/event_handler/private/src/event_handler_activator.c
deleted file mode 100644
index d39cfd9..0000000
--- a/event_admin/event_handler/private/src/event_handler_activator.c
+++ /dev/null
@@ -1,104 +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.
- */
-/*
- * event_handler_activator.c
- *
- * Created on: Jul 9, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-
-
-#include "event_handler_impl.h"
-
-static const char * const EVENT_HANDLER_NAME = "demo";
-struct activator {
- event_handler_service_pt event_handler_service;
- service_registration_pt registration;
- service_tracker_pt eventAdminTracker;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator;
-
- activator = calloc(1, sizeof(*activator));
- activator->registration = NULL;
- *userData = activator;
-
- event_handler_pt event_handler = NULL;
- event_handler_service_pt event_handler_service = NULL;
-
- status = eventHandlerCreate(context, &event_handler);
- if (status == CELIX_SUCCESS) {
- event_handler_service = calloc(1, sizeof(event_handler_service));
- if (!event_handler_service) {
- status = CELIX_ENOMEM;
- } else {
- event_handler_service->event_handler = event_handler;
- event_handler_service->handle_event = eventHandlerHandleEvent;
- }
- }
- activator->event_handler_service = event_handler_service;
-
-
- return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator = userData;
-
- properties_pt properties = NULL;
- properties = properties_create();
- properties_set(properties, (char *) EVENT_HANDLER_SERVICE, (const char *) EVENT_HANDLER_NAME);
- properties_set(properties, (char *) EVENT_TOPIC, (const char *) "log/error/eventpublishers/event");
-
- event_handler_service_pt event_handler_service = activator->event_handler_service;
- bundleContext_registerService(context, (const char *) EVENT_HANDLER_SERVICE, event_handler_service, properties,
- &activator->registration);
-
- /*if (status == CELIX_SUCCESS) {
- service_tracker_customizer_pt customizer = NULL;
- service_tracker_pt tracker = NULL;
- serviceTrackerCustomizer_create(activator->event_handler_service->event_handler, eventHandlerAddingService, eventHandlerAddedService, eventHandlerModifiedService, eventHandlerRemovedService, &customizer);
- serviceTracker_create(context, (const char *) EVENT_ADMIN_NAME, customizer, &tracker);
- activator->eventAdminTracker = tracker;
- serviceTracker_open(tracker);
- }*/
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *data = userData;
- serviceRegistration_unregister(data->registration);
- //serviceTracker_close(data->tracker);
- //status = logHelper_stop(data->loghelper);
- //logHelper_destroy(&data->loghelper);
- return status;
-}
-
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_handler/private/src/event_handler_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_handler/private/src/event_handler_impl.c b/event_admin/event_handler/private/src/event_handler_impl.c
deleted file mode 100644
index 52ff1b7..0000000
--- a/event_admin/event_handler/private/src/event_handler_impl.c
+++ /dev/null
@@ -1,111 +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.
- */
-/*
- * event_admin_impl.c
- *
- * Created on: Jul 24, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include "event_handler.h"
-#include "log_helper.h"
-#include "log_service.h"
-
-struct event_handler {
- event_admin_service_pt event_admin_service;
- bundle_context_pt context;
- log_helper_pt loghelper;
-
-};
-
-celix_status_t eventHandlerCreate(bundle_context_pt context, event_handler_pt *event_handler) {
- celix_status_t status = CELIX_SUCCESS;
- *event_handler = calloc(1, sizeof(**event_handler));
- if (!*event_handler) {
- status = CELIX_ENOMEM;
- } else {
- (*event_handler)->event_admin_service = NULL;
- (*event_handler)->context = context;
-
- if (logHelper_create(context, &(*event_handler)->loghelper) == CELIX_SUCCESS) {
- logHelper_start((*event_handler)->loghelper);
- }
- }
- return status;
-}
-
-celix_status_t eventHandlerHandleEvent(event_handler_pt *event_handler, event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
- if (event != NULL) {
- const char *topic = event->topic;
- //status = (*event_handler)->event_admin_service->getTopic(&event, &topic);
- logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] topic of event: %s.", topic);
-
- array_list_pt propertyNames;
- arrayList_create(&propertyNames);
- properties_pt properties = event->properties;
- if (hashMap_size(properties) > 0) {
- hash_map_iterator_pt iterator = hashMapIterator_create(properties);
- while (hashMapIterator_hasNext(iterator)) {
- hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
- char *key = hashMapEntry_getKey(entry);
- arrayList_add(propertyNames, key);
- }
- }
- array_list_iterator_pt propertyIter = arrayListIterator_create(propertyNames);
- while (arrayListIterator_hasNext(propertyIter)) {
- char *key = arrayListIterator_next(propertyIter);
- const char *value = NULL;
- value = properties_get((*event).properties, key);
-
-
- logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] Key: %s value: %s.", key, value);
- }
- }
- return status;
-}
-
-
-celix_status_t eventHandlerAddingService(void * handle, service_reference_pt ref, void **service) {
- celix_status_t status = CELIX_SUCCESS;
- event_handler_pt event_handler = handle;
- status = bundleContext_getService(event_handler->context, ref, service);
- return status;
-}
-
-celix_status_t eventHandlerAddedService(void * handle, service_reference_pt ref, void * service) {
- event_handler_pt data = (event_handler_pt) handle;
- logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin added.");
- data->event_admin_service = (event_admin_service_pt) service;
- return CELIX_SUCCESS;
-}
-
-celix_status_t eventHandlerModifiedService(void * handle, service_reference_pt ref, void * service) {
- event_handler_pt data = (event_handler_pt) handle;
- logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin modified.");
- return CELIX_SUCCESS;
-}
-
-celix_status_t eventHandlerRemovedService(void * handle, service_reference_pt ref, void * service) {
- event_handler_pt data = (event_handler_pt) handle;
- logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin removed.");
- data->event_admin_service = NULL;
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_publisher/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/event_admin/event_publisher/CMakeLists.txt b/event_admin/event_publisher/CMakeLists.txt
deleted file mode 100644
index 4dd314a..0000000
--- a/event_admin/event_publisher/CMakeLists.txt
+++ /dev/null
@@ -1,34 +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(private/include)
-include_directories(${PROJECT_SOURCE_DIR}/event_admin/event_admin/public/include)
-include_directories(${PROJECT_SOURCE_DIR}/log_service/public/include)
-
-add_celix_bundle(event_publisher
- VERSION 0.0.0
- SOURCES
- private/src/event_publisher_activator.c
- private/src/event_publisher_impl.c
- ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
-)
-
-install_celix_bundle(event_publisher)
-
-target_link_libraries(event_publisher Celix::framework)
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_publisher/private/include/event_publisher_impl.h
----------------------------------------------------------------------
diff --git a/event_admin/event_publisher/private/include/event_publisher_impl.h b/event_admin/event_publisher/private/include/event_publisher_impl.h
deleted file mode 100644
index a2cab83..0000000
--- a/event_admin/event_publisher/private/include/event_publisher_impl.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * event_publisher.h
- *
- * Created on: Aug 9, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef EVENT_PUBLISHER_H_
-#define EVENT_PUBLISHER_H_
-#include "celix_errno.h"
-#include "event_admin.h"
-
-#include "listener_hook_service.h"
-#include "service_tracker.h"
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_tracker.h"
-#include "service_listener.h"
-#include "service_registration.h"
-#include "event_constants.h"
-#include "log_helper.h"
-#include "log_service.h"
-
-
-typedef struct event_publisher *event_publisher_pt;
-struct event_publisher {
- event_admin_service_pt event_admin_service;
- bool running;
- bool eventAdminAdded;
- celix_thread_t sender;
- bundle_context_pt context;
- log_helper_pt loghelper;
-};
-/**
- * @desc create the event publisher
- * @param apr_pool_t *pool. the memory pool to store the publisher
- * @param bundle_context_pt context the bundle context
- * @param event_publisher_pt *event_publisher. The publisher to be made.
- */
-celix_status_t eventPublisherCreate(bundle_context_pt context, event_publisher_pt *event_publisher);
-/**
- * @desc start the event publisher. Starts the threads and trackers.
- * @param event_publisher_pt *event_publisher the publisher to start
- */
-celix_status_t eventPublisherStart(event_publisher_pt *event_publisher);
-
-/**
- * @desc functions used by the event admin tracker
- * @param void *handle, pointer to the event publisher
- * @param service_reference_pt ref. pointer to the reference of the event admin
- * @param void **service. pointer to the event admin service.
- */
-celix_status_t eventPublisherAddingService(void * handle, service_reference_pt ref, void **service);
-celix_status_t eventPublisherAddedService(void * handle, service_reference_pt ref, void * service);
-celix_status_t eventPublisherModifiedService(void * handle, service_reference_pt ref, void * service);
-celix_status_t eventPublisherRemovedService(void * handle, service_reference_pt ref, void * service);
-/**
- * @desc stop the event publisher. stopping threads and tracker
- * @param event_publisher_pt *event_publisher. pointer to the publisher.
- */
-celix_status_t eventPublisherStop(event_publisher_pt *event_publisher);
-
-void *produceEvents(void *handle);
-#endif /* EVENT_PUBLISHER_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_publisher/private/src/event_publisher_activator.c
----------------------------------------------------------------------
diff --git a/event_admin/event_publisher/private/src/event_publisher_activator.c b/event_admin/event_publisher/private/src/event_publisher_activator.c
deleted file mode 100644
index 279942f..0000000
--- a/event_admin/event_publisher/private/src/event_publisher_activator.c
+++ /dev/null
@@ -1,86 +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
- *
- * Created on: Jul 9, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-
-#include "event_publisher_impl.h"
-
-struct activator {
- bundle_context_pt context;
- event_publisher_pt event_publisher;
- service_tracker_pt tracker;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
-
- struct activator *activator = NULL;
-
- activator = calloc(1, sizeof(*activator));
- activator->context = context;
- *userData = activator;
-
- event_publisher_pt eventpublisher;
- status = eventPublisherCreate(context, &eventpublisher);
- if(status == CELIX_SUCCESS) {
- activator->event_publisher = eventpublisher;
-
- }
-
- return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator * data = (struct activator *) userData;
-
-
- service_tracker_customizer_pt cust = NULL;
- service_tracker_pt tracker = NULL;
- data->context = context;
- serviceTrackerCustomizer_create(data->event_publisher, eventPublisherAddingService, eventPublisherAddedService, eventPublisherModifiedService, eventPublisherRemovedService, &cust);
- serviceTracker_create(context, (char *) EVENT_ADMIN_NAME, cust, &tracker);
- data->tracker = tracker;
-
- serviceTracker_open(tracker);
-
- eventPublisherStart(&data->event_publisher);
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator * data = (struct activator *) userData;
- eventPublisherStop(&data->event_publisher);
- serviceTracker_close(data->tracker);
- return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
-
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/event_admin/event_publisher/private/src/event_publisher_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/event_publisher/private/src/event_publisher_impl.c b/event_admin/event_publisher/private/src/event_publisher_impl.c
deleted file mode 100644
index 6a8bc00..0000000
--- a/event_admin/event_publisher/private/src/event_publisher_impl.c
+++ /dev/null
@@ -1,141 +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.
- */
-/*
- * event_publisher_impl.c
- *
- * Created on: Jul 24, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include <unistd.h>
-#include <sys/time.h>
-#include "event_publisher_impl.h"
-
-celix_thread_start_t eventPublisherSendEventThread(celix_thread_t *thd, void *handle);
-
-celix_status_t eventPublisherCreate(bundle_context_pt context, event_publisher_pt *event_publisher) {
- celix_status_t status = CELIX_SUCCESS;
- *event_publisher = calloc(1, sizeof(**event_publisher));
- if (!*event_publisher) {
- status = CELIX_ENOMEM;
- } else {
- (*event_publisher)->event_admin_service = NULL;
-
- (*event_publisher)->eventAdminAdded = false;
- (*event_publisher)->running = false;
- (*event_publisher)->context = context;
- (*event_publisher)->sender = celix_thread_default;
- logHelper_create(context, &(*event_publisher)->loghelper);
- }
- return status;
-}
-
-celix_status_t eventPublisherStart(event_publisher_pt *event_publisher) {
- celix_status_t status = CELIX_SUCCESS;
- (*event_publisher)->running = true;
- logHelper_start((*event_publisher)->loghelper);
- // celixThread_create((*event_publisher)->sender, NULL, eventPublisherSendEventThread, event_publisher);
- status = celixThread_create(&(*event_publisher)->sender, NULL, produceEvents, &(*event_publisher));
- return status;
-}
-
-celix_status_t eventPublisherStop(event_publisher_pt *event_publisher) {
- (*event_publisher)->running = false;
- //void * status;
- // celixThread_join((*event_publisher)->sender, &status);
- logHelper_stop((*event_publisher)->loghelper);
- logHelper_destroy(&(*event_publisher)->loghelper);
- return CELIX_SUCCESS;
-}
-
-void *produceEvents(void *handle) {
- event_publisher_pt *event_publisher = handle;
- while ((*event_publisher)->running && (*event_publisher)->eventAdminAdded) {
- // sleep(1000000); // 1 sec.
- event_admin_service_pt *event_admin_service = &(*event_publisher)->event_admin_service;
- event_admin_pt event_admin = (*event_admin_service)->eventAdmin;
- if (event_admin_service != NULL) {
- event_pt event;
- properties_pt props = properties_create();
- properties_set(props, "This is a key", "this is a value");
- (*event_admin_service)->createEvent(event_admin, "log/error/eventpublishers/event", props, &event);
- (*event_admin_service)->postEvent(event_admin, event);
- (*event_admin_service)->sendEvent(event_admin, event);
- printf("send event\n");
- }
- }
- return CELIX_SUCCESS;
-}
-
-/*celix_thread_start_t eventPublisherSendEventThread(celix_thread_t *thd, void *handle) {
- event_publisher_pt *client = (event_publisher_pt *) handle;
-
- while ((*client)->running && (*client)->eventAdminAdded) {
- apr_sleep(1000000); // 1 sec.
-
- event_admin_service_pt *event_admin_service = &(*client)->event_admin_service;
- event_admin_pt event_admin = (*event_admin_service)->eventAdmin;
- if (event_admin_service != NULL) {
- event_pt event;
- properties_pt props = properties_create();
- properties_set(props, "This is a key", "this is a value");
- (*event_admin_service)->createEvent(event_admin, "log/error/eventpublishers/event", props, &event);
- (*event_admin_service)->postEvent(event_admin, event);
- (*event_admin_service)->sendEvent(event_admin, event);
- }
- }
- celixThread_exit( APR_SUCCESS);
- return NULL;*
-}*/
-
-celix_status_t eventPublisherAddingService(void * handle, service_reference_pt ref, void **service) {
- celix_status_t status = CELIX_SUCCESS;
- event_publisher_pt event_publisher = handle;
- status = bundleContext_getService(event_publisher->context, ref, service);
-
- return status;
-}
-
-celix_status_t eventPublisherAddedService(void * handle, service_reference_pt ref, void * service) {
- event_publisher_pt data = (event_publisher_pt) handle;
- logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[PUB] Event admin added.");
- printf(" added event admin");
- data->event_admin_service = (event_admin_service_pt) service;
- data->eventAdminAdded = true;
- return CELIX_SUCCESS;
-}
-
-celix_status_t eventPublisherModifiedService(void * handle, service_reference_pt ref, void * service) {
- event_publisher_pt data = (event_publisher_pt) handle;
- logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[PUB] Event admin modified.");
- return CELIX_SUCCESS;
-}
-
-celix_status_t eventPublisherRemovedService(void * handle, service_reference_pt ref, void * service) {
- event_publisher_pt data = (event_publisher_pt) handle;
- logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[PUB] Event admin removed.");
-
- data->event_admin_service = NULL;
- data->eventAdminAdded = false;
- return CELIX_SUCCESS;
-}
-
-
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
deleted file mode 100644
index 1f0f423..0000000
--- a/framework/CMakeLists.txt
+++ /dev/null
@@ -1,357 +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.
-
-find_package(ZLIB REQUIRED)
-find_package(UUID REQUIRED)
-find_package(CURL REQUIRED)
-
-if(WIN32)
- set(IO src/iowin32.c)
-endif(WIN32)
-
-set(SOURCES
- src/attribute.c src/bundle.c src/bundle_archive.c src/bundle_cache.c
- src/bundle_context.c src/bundle_revision.c src/capability.c src/celix_errorcodes.c
- src/framework.c src/manifest.c src/ioapi.c
- src/manifest_parser.c src/miniunz.c src/module.c
- src/requirement.c src/resolver.c src/service_reference.c src/service_registration.c
- src/service_registry.c src/service_tracker.c src/service_tracker_customizer.c
- src/unzip.c src/wire.c
- src/celix_log.c src/celix_launcher.c
- src/celix_framework_factory.c
- src/dm_dependency_manager_impl.c src/dm_component_impl.c
- src/dm_service_dependency.c src/dm_event.c
- ${IO}
-)
-add_library(framework SHARED ${SOURCES})
-set_target_properties(framework PROPERTIES OUTPUT_NAME "celix_framework")
-target_include_directories(framework PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
- $<INSTALL_INTERFACE:include/celix>
-)
-target_include_directories(framework PRIVATE src)
-target_include_directories(framework SYSTEM PRIVATE
- ${ZLIB_INCLUDE_DIR}
- ${CURL_INCLUDE_DIR}
- ${UUID_INCLUDE_DIR}
-)
-target_compile_definitions(framework PRIVATE -DUSE_FILE32API)
-
-set_target_properties(framework PROPERTIES "SOVERSION" 2)
-
-if(NOT APPLE)
- set(UUID ${UUID_LIBRARY})
-endif()
-target_link_libraries(framework PUBLIC Celix::utils)
-target_link_libraries(framework PRIVATE ${UUID} ${ZLIB_LIBRARY} ${CURL_LIBRARIES})
-
-install(TARGETS framework EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
-install(DIRECTORY include/ DESTINATION include/celix COMPONENT framework)
-
-#Alias setup to match external usage
-add_library(Celix::framework ALIAS framework)
-
-
-if (ENABLE_TESTING)
- find_package(CppUTest REQUIRED)
- include_directories(${CPPUTEST_INCLUDE_DIR})
- add_subdirectory(tst)
-endif()
-
-
-celix_subproject(FRAMEWORK_TESTS "Option to build the framework tests" "OFF" DEPS)
-if (ENABLE_TESTING AND FRAMEWORK_TESTS)
- find_package(CppUTest REQUIRED)
-
- include_directories(${CPPUTEST_INCLUDE_DIR})
- include_directories(${CPPUTEST_EXT_INCLUDE_DIR})
- include_directories(include src)
-
-
- add_executable(attribute_test
- private/test/attribute_test.cpp
- src/attribute.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(attribute_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
-# add_executable(bundle_archive_test
-# private/mock/celix_log_mock.c
-# private/test/bundle_archive_test.cpp
-# src/bundle_revision.c
-# src/manifest.c
-# src/miniunz.c
-# src/unzip.c
-# src/ioapi.c
-# src/properties.c
-# src/bundle_archive.c
-# src/celix_errorcodes.c
-# src/utils.c)
-# target_link_libraries(bundle_archive_test Celix::utils ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} ${ZLIB_LIBRARY} pthread)
-
-
- add_executable(bundle_cache_test
- private/test/bundle_cache_test.cpp
- private/mock/bundle_archive_mock.c
- private/mock/properties_mock.c
- src/bundle_cache.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(bundle_cache_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(bundle_context_test
- private/test/bundle_context_test.cpp
- private/mock/bundle_mock.c
- private/mock/framework_mock.c
- private/mock/service_registry_mock.c
- private/mock/service_registration_mock.c
- private/mock/service_reference_mock.c
- src/service_tracker.c #TODO make mock for svc tracker
- src/service_tracker_customizer.c
- src/bundle_context.c
- src/celix_errorcodes.c
- private/mock/dm_dependency_manager_mock.c
- private/mock/celix_log_mock.c)
- target_link_libraries(bundle_context_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(bundle_revision_test
- private/test/bundle_revision_test.cpp
- private/mock/miniunz_mock.c
- private/mock/manifest_mock.c
- src/bundle_revision.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(bundle_revision_test ${ZLIB_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(bundle_test
- private/test/bundle_test.cpp
- private/mock/framework_mock.c
- private/mock/module_mock.c
- private/mock/bundle_archive_mock.c
- private/mock/bundle_revision_mock.c
- private/mock/resolver_mock.c
- private/mock/version_mock.c
- src/bundle.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(bundle_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(capability_test
- private/test/capability_test.cpp
- private/mock/attribute_mock.c
- private/mock/version_mock.c
- src/capability.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(capability_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(celix_errorcodes_test
- private/test/celix_errorcodes_test.cpp
- src/celix_errorcodes.c)
- target_link_libraries(celix_errorcodes_test ${CPPUTEST_LIBRARY} Celix::utils)
-
- add_executable(framework_test
- private/test/framework_test.cpp
- #private/mock/properties_mock.c
- private/mock/resolver_mock.c
- private/mock/service_reference_mock.c
- private/mock/service_registry_mock.c
- private/mock/service_registration_mock.c
- private/mock/filter_mock.c
- private/mock/bundle_mock.c
- private/mock/bundle_context_mock.c
- private/mock/module_mock.c
- private/mock/bundle_archive_mock.c
- private/mock/bundle_revision_mock.c
- private/mock/bundle_cache_mock.c
- private/mock/manifest_mock.c
- private/mock/dm_dependency_manager_mock.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c
- src/framework.c)
- target_link_libraries(framework_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} ${UUID} Celix::utils pthread dl)
-
- add_executable(manifest_parser_test
- private/test/manifest_parser_test.cpp
- private/mock/manifest_mock.c
- private/mock/version_mock.c
- private/mock/version_range_mock.c
- src/attribute.c
- src/capability.c
- src/requirement.c
- src/manifest_parser.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(manifest_parser_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(manifest_test
- private/test/manifest_test.cpp
- private/mock/properties_mock.c
- src/manifest.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(manifest_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
-# add_executable(module_test
-# private/test/module_test.cpp
-# private/mock/bundle_mock.c
-# private/mock/version_mock.c
-# private/mock/manifest_mock.c
-# private/mock/manifest_parser_mock.c
-# private/mock/capability_mock.c
-# private/mock/requirement_mock.c
-# private/mock/wire_mock.c
-# src/module.c)
-# target_link_libraries(module_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(requirement_test
- private/test/requirement_test.cpp
- private/mock/attribute_mock.c
- private/mock/capability_mock.c
- private/mock/version_range_mock.c
- src/requirement.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(requirement_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
-# add_executable(resolver_test
-# private/test/resolver_test.cpp
-# private/mock/bundle_mock.c
-# private/mock/requirement_mock.c
-# private/mock/capability_mock.c
-# private/mock/manifest_parser_mock.c
-# private/mock/version_mock.c
-# src/wire.c
-# src/module.c
-# src/resolver.c
-# src/celix_errorcodes.c
-# private/mock/celix_log_mock.c)
-# target_link_libraries(resolver_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(service_reference_test
- private/test/service_reference_test.cpp
- private/mock/properties_mock.c
- private/mock/service_registration_mock.c
- private/mock/service_registry_mock.c
- src/service_reference.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(service_reference_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(service_registration_test
- private/test/service_registration_test.cpp
- private/mock/service_registry_mock.c
- src/service_registration.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(service_registration_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
-
- add_executable(service_registry_test
- private/test/service_registry_test.cpp
- private/mock/framework_mock.c
- private/mock/bundle_mock.c
- private/mock/filter_mock.c
- private/mock/service_reference_mock.c
- private/mock/service_registration_mock.c
- private/mock/properties_mock.c
- src/service_registry.c
- private/mock/module_mock.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(service_registry_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
- add_executable(service_tracker_customizer_test
- private/test/service_tracker_customizer_test.cpp
- private/mock/service_reference_mock.c
- src/service_tracker_customizer.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c)
- target_link_libraries(service_tracker_customizer_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
-# add_executable(service_tracker_test
-# private/test/service_tracker_test.cpp
-# private/mock/bundle_context_mock.c
-# private/mock/service_reference_mock.c
-# private/mock/service_tracker_customizer_mock.c
-# src/service_tracker.c
-# src/celix_errorcodes.c
-# private/mock/celix_log_mock.c)
-# target_link_libraries(service_tracker_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
-
-
- add_executable(wire_test
- private/mock/requirement_mock.c
- private/mock/capability_mock.c
- private/mock/module_mock.c
- src/celix_errorcodes.c
- private/mock/celix_log_mock.c
- src/wire.c
- private/test/wire_test.cpp)
- target_link_libraries(wire_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils)
-
- configure_file(private/resources-test/manifest_sections.txt ${CMAKE_BINARY_DIR}/framework/resources-test/manifest_sections.txt COPYONLY)
- configure_file(private/resources-test/manifest.txt ${CMAKE_BINARY_DIR}/framework/resources-test/manifest.txt COPYONLY)
-
- #set_target_properties(wire_test PROPERTIES COMPILE_FLAGS "-include ${CPPUTEST_INCLUDE_DIR}/CppUTest/MemoryLeakDetectorMallocMacros.h -include ${CPPUTEST_INCLUDE_DIR}/CppUTest/MemoryLeakDetectorNewMacros.h")
-
- add_test(NAME attribute_test COMMAND attribute_test)
-# add_test(NAME bundle_archive_test COMMAND bundle_archive_test)
- add_test(NAME bundle_cache_test COMMAND bundle_cache_test)
- add_test(NAME bundle_context_test COMMAND bundle_context_test)
- add_test(NAME bundle_revision_test COMMAND bundle_revision_test)
- add_test(NAME bundle_test COMMAND bundle_test)
- add_test(NAME capability_test COMMAND capability_test)
- add_test(NAME celix_errorcodes_test COMMAND celix_errorcodes_test)
- add_test(NAME filter_test COMMAND filter_test)
- add_test(NAME framework_test COMMAND framework_test)
- add_test(NAME manifest_parser_test COMMAND manifest_parser_test)
- add_test(NAME manifest_test COMMAND manifest_test)
-# add_test(NAME module_test COMMAND module_test)
- add_test(NAME requirement_test COMMAND requirement_test)
-# add_test(NAME resolver_test COMMAND resolver_test)
- add_test(NAME service_reference_test COMMAND service_reference_test)
- add_test(NAME service_registration_test COMMAND service_registration_test)
- add_test(NAME service_registry_test COMMAND service_registry_test)
- add_test(NAME service_tracker_customizer_test COMMAND service_tracker_customizer_test)
-# add_test(NAME service_tracker_test COMMAND service_tracker_test)
-add_test(NAME wire_test COMMAND wire_test)
-
-SETUP_TARGET_FOR_COVERAGE(attribute_test attribute_test ${CMAKE_BINARY_DIR}/coverage/attribute_test/attribute_test)
-# SETUP_TARGET_FOR_COVERAGE(bundle_archive_test bundle_archive_test ${CMAKE_BINARY_DIR}/coverage/bundle_archive_test/bundle_archive_test)
- SETUP_TARGET_FOR_COVERAGE(bundle_cache_test bundle_cache_test ${CMAKE_BINARY_DIR}/coverage/bundle_cache_test/bundle_cache_test)
- SETUP_TARGET_FOR_COVERAGE(bundle_context_test bundle_context_test ${CMAKE_BINARY_DIR}/coverage/bundle_context_test/bundle_context_test)
- SETUP_TARGET_FOR_COVERAGE(bundle_revision_test bundle_revision_test ${CMAKE_BINARY_DIR}/coverage/bundle_revision_test/bundle_revision_test)
- SETUP_TARGET_FOR_COVERAGE(bundle_test bundle_test ${CMAKE_BINARY_DIR}/coverage/bundle_test/bundle_test)
- SETUP_TARGET_FOR_COVERAGE(capability_test capability_test ${CMAKE_BINARY_DIR}/coverage/capability_test/capability_test)
- SETUP_TARGET_FOR_COVERAGE(celix_errorcodes_test celix_errorcodes_test ${CMAKE_BINARY_DIR}/coverage/celix_errorcodes_test/celix_errorcodes_test)
- SETUP_TARGET_FOR_COVERAGE(filter_test filter_test ${CMAKE_BINARY_DIR}/coverage/filter_test/filter_test)
- SETUP_TARGET_FOR_COVERAGE(framework_test framework_test ${CMAKE_BINARY_DIR}/coverage/framework_test/framework_test)
- SETUP_TARGET_FOR_COVERAGE(manifest_parser_test manifest_parser_test ${CMAKE_BINARY_DIR}/coverage/manifest_parser_test/manifest_parser_test)
- SETUP_TARGET_FOR_COVERAGE(manifest_test manifest_test ${CMAKE_BINARY_DIR}/coverage/manifest_test/manifest_test)
-# SETUP_TARGET_FOR_COVERAGE(module_test module_test ${CMAKE_BINARY_DIR}/coverage/module_test/module_test)
- SETUP_TARGET_FOR_COVERAGE(requirement_test requirement_test ${CMAKE_BINARY_DIR}/coverage/requirement_test/requirement_test)
-# SETUP_TARGET_FOR_COVERAGE(resolver_test resolver_test ${CMAKE_BINARY_DIR}/coverage/resolver_test/resolver_test)
- SETUP_TARGET_FOR_COVERAGE(service_reference_test service_reference_test ${CMAKE_BINARY_DIR}/coverage/service_reference_test/service_reference_test)
- SETUP_TARGET_FOR_COVERAGE(service_registration_test service_registration_test ${CMAKE_BINARY_DIR}/coverage/service_registration_test/service_registration_test)
- SETUP_TARGET_FOR_COVERAGE(service_registry_test service_registry_test ${CMAKE_BINARY_DIR}/coverage/service_registry_test/service_registry_test)
- SETUP_TARGET_FOR_COVERAGE(service_tracker_customizer_test service_tracker_customizer_test ${CMAKE_BINARY_DIR}/coverage/service_tracker_customizer_test/service_tracker_customizer_test)
-# SETUP_TARGET_FOR_COVERAGE(service_tracker_test service_tracker_test ${CMAKE_BINARY_DIR}/coverage/service_tracker_test/service_tracker_test)
- SETUP_TARGET_FOR_COVERAGE(wire_test wire_test ${CMAKE_BINARY_DIR}/coverage/wire_test/wire_test)
-
-endif (ENABLE_TESTING AND FRAMEWORK_TESTS)
-
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/archive.h
----------------------------------------------------------------------
diff --git a/framework/include/archive.h b/framework/include/archive.h
deleted file mode 100644
index f51b960..0000000
--- a/framework/include/archive.h
+++ /dev/null
@@ -1,58 +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.
- */
-/**
- *
- * @defgroup Archive Archive
- * @ingroup framework
- * @{
- *
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \date May 31, 2010
- * \copyright Apache License, Version 2.0
- */
-#ifndef ARCHIVE_H_
-#define ARCHIVE_H_
-
-#include "celix_errno.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Extracts the bundle pointed to by bundleName to the given root.
- *
- * @param bundleName location of the bundle to extract.
- * @param revisionRoot directory to where the bundle must be extracted.
- *
- * @return Status code indication failure or success:
- * - CELIX_SUCCESS when no errors are encountered.
- * - CELIX_FILE_IO_EXCEPTION If the zip file cannot be extracted.
- */
-celix_status_t extractBundle(const char *bundleName, const char *revisionRoot);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ARCHIVE_H_ */
-
-/**
- * @}
- */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/bundle.h
----------------------------------------------------------------------
diff --git a/framework/include/bundle.h b/framework/include/bundle.h
deleted file mode 100644
index b105615..0000000
--- a/framework/include/bundle.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * bundle.h
- *
- * \date Mar 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef BUNDLE_H_
-#define BUNDLE_H_
-
-#include "celix_types.h"
-
-#include "celix_errno.h"
-#include "bundle_state.h"
-#include "bundle_archive.h"
-#include "framework.h"
-#include "wire.h"
-#include "module.h"
-#include "service_reference.h"
-#include "bundle_context.h"
-#include "celix_log.h"
-#include "celix_threads.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-FRAMEWORK_EXPORT celix_status_t bundle_create(bundle_pt *bundle);
-
-FRAMEWORK_EXPORT celix_status_t
-bundle_createFromArchive(bundle_pt *bundle, framework_pt framework, bundle_archive_pt archive);
-
-FRAMEWORK_EXPORT celix_status_t bundle_destroy(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_isSystemBundle(bundle_pt bundle, bool *systemBundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getArchive(bundle_pt bundle, bundle_archive_pt *archive);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getCurrentModule(bundle_pt bundle, module_pt *module);
-
-FRAMEWORK_EXPORT array_list_pt bundle_getModules(bundle_pt bundle);
-
-FRAMEWORK_EXPORT void *bundle_getHandle(bundle_pt bundle);
-
-FRAMEWORK_EXPORT void bundle_setHandle(bundle_pt bundle, void *handle);
-
-FRAMEWORK_EXPORT activator_pt bundle_getActivator(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_setActivator(bundle_pt bundle, activator_pt activator);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getContext(bundle_pt bundle, bundle_context_pt *context);
-
-FRAMEWORK_EXPORT celix_status_t bundle_setContext(bundle_pt bundle, bundle_context_pt context);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getEntry(bundle_pt bundle, const char *name, char **entry);
-
-FRAMEWORK_EXPORT celix_status_t bundle_start(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_startWithOptions(bundle_pt bundle, int options);
-
-FRAMEWORK_EXPORT celix_status_t bundle_update(bundle_pt bundle, const char *inputFile);
-
-FRAMEWORK_EXPORT celix_status_t bundle_stop(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_stopWithOptions(bundle_pt bundle, int options);
-
-FRAMEWORK_EXPORT celix_status_t bundle_uninstall(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_setState(bundle_pt bundle, bundle_state_e state);
-
-FRAMEWORK_EXPORT celix_status_t bundle_setPersistentStateInactive(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_setPersistentStateUninstalled(bundle_pt bundle);
-
-FRAMEWORK_EXPORT void uninstallBundle(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_revise(bundle_pt bundle, const char *location, const char *inputFile);
-
-FRAMEWORK_EXPORT celix_status_t bundle_addModule(bundle_pt bundle, module_pt module);
-
-FRAMEWORK_EXPORT celix_status_t bundle_closeModules(bundle_pt bundle);
-
-// Service Reference Functions
-FRAMEWORK_EXPORT array_list_pt getUsingBundles(service_reference_pt reference);
-
-FRAMEWORK_EXPORT int compareTo(service_reference_pt a, service_reference_pt b);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getState(bundle_pt bundle, bundle_state_e *state);
-
-FRAMEWORK_EXPORT celix_status_t bundle_isLockable(bundle_pt bundle, bool *lockable);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getLockingThread(bundle_pt bundle, celix_thread_t *thread);
-
-FRAMEWORK_EXPORT celix_status_t bundle_lock(bundle_pt bundle, bool *locked);
-
-FRAMEWORK_EXPORT celix_status_t bundle_unlock(bundle_pt bundle, bool *unlocked);
-
-FRAMEWORK_EXPORT celix_status_t bundle_closeAndDelete(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_close(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_refresh(bundle_pt bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getBundleId(bundle_pt bundle, long *id);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getRegisteredServices(bundle_pt bundle, array_list_pt *list);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getServicesInUse(bundle_pt bundle, array_list_pt *list);
-
-FRAMEWORK_EXPORT celix_status_t bundle_setFramework(bundle_pt bundle, framework_pt framework);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getFramework(bundle_pt bundle, framework_pt *framework);
-
-FRAMEWORK_EXPORT celix_status_t bundle_getBundleLocation(bundle_pt bundle, const char **location);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BUNDLE_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/bundle_activator.h
----------------------------------------------------------------------
diff --git a/framework/include/bundle_activator.h b/framework/include/bundle_activator.h
deleted file mode 100644
index 8c91957..0000000
--- a/framework/include/bundle_activator.h
+++ /dev/null
@@ -1,127 +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.
- */
-/**
- *
- * @defgroup BundleActivator BundleActivator
- * @ingroup framework
- * @{
- * \brief Customizes the starting and stopping of a bundle.
- * \details \ref BundleActivator is a header that must be implemented by every
- * bundle. The Framework creates/starts/stops/destroys activator instances using the
- * functions described in this header. If the bundleActivator_start()
- * function executes successfully, it is guaranteed that the same instance's
- * bundleActivator_stop() function will be called when the bundle is
- * to be stopped. The same applies to the bundleActivator_create() and
- * bundleActivator_destroy() functions.
- * The Framework must not concurrently call the activator functions.
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \date March 18, 2010
- * \copyright Apache License, Version 2.0
- */
-#ifndef BUNDLE_ACTIVATOR_H_
-#define BUNDLE_ACTIVATOR_H_
-
-#include "bundle_context.h"
-#include "celix_bundle_context.h"
-#include "framework_exports.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Called when this bundle is started so the bundle can create an instance for its activator.
- * The framework does not assume any type for the activator instance, this is implementation specific.
- * The activator instance is handle as a void pointer by the framework, the implementation must cast it to the
- * implementation specific type.
- *
- * @param context The execution context of the bundle being started.
- * @param[out] userData A pointer to the specific activator instance used by this bundle.
- *
- * @return Status code indication failure or success:
- * - CELIX_SUCCESS when no errors are encountered.
- * - Any other status code will mark the bundle as stopped and the framework will remove this
- * bundle's listeners, unregister all services, and release all services used by this bundle.
- */
-ACTIVATOR_EXPORT celix_status_t bundleActivator_create(bundle_context_t *context_ptr, void **userData);
-
-/**
- * Called when this bundle is started so the Framework can perform the bundle-specific activities necessary
- * to start this bundle. This method can be used to register services or to allocate any resources that this
- * bundle needs.
- *
- * <p>
- * This method must complete and return to its caller in a timely manner.
- *
- * @param userData The activator instance to be used.
- * @param context The execution context of the bundle being started.
- *
- * @return Status code indication failure or success:
- * - CELIX_SUCCESS when no errors are encountered.
- * - Any other status code will mark the bundle as stopped and the framework will remove this
- * bundle's listeners, unregister all services, and release all services used by this bundle.
- */
-ACTIVATOR_EXPORT celix_status_t bundleActivator_start(void *userData, bundle_context_t *context);
-
-/**
- * Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary
- * to stop the bundle. In general, this method should undo the work that the <code>bundleActivator_start()</code>
- * function started. There should be no active threads that were started by this bundle when this bundle returns.
- * A stopped bundle must not call any Framework objects.
- *
- * <p>
- * This method must complete and return to its caller in a timely manner.
- *
- * @param userData The activator instance to be used.
- * @param context The execution context of the bundle being stopped.
- *
- * @return Status code indication failure or success:
- * - CELIX_SUCCESS when no errors are encountered.
- * - Any other status code will mark the bundle as stopped and the framework will remove this
- * bundle's listeners, unregister all services, and release all services used by this bundle.
- */
-ACTIVATOR_EXPORT celix_status_t bundleActivator_stop(void *userData, bundle_context_t *context);
-
-/**
- * Called when this bundle is stopped so the bundle can destroy the instance of its activator. In general, this
- * method should undo the work that the <code>bundleActivator_create()</code> function initialized.
- *
- * <p>
- * This method must complete and return to its caller in a timely manner.
- *
- * @param userData The activator instance to be used.
- * @param context The execution context of the bundle being stopped.
- *
- * @return Status code indication failure or success:
- * - CELIX_SUCCESS when no errors are encountered.
- * - Any other status code will mark the bundle as stopped and the framework will remove this
- * bundle's listeners, unregister all services, and release all services used by this bundle.
- */
-ACTIVATOR_EXPORT celix_status_t
-bundleActivator_destroy(void *userData, bundle_context_t* context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BUNDLE_ACTIVATOR_H_ */
-
-/**
- * @}
- */
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/bundle_archive.h
----------------------------------------------------------------------
diff --git a/framework/include/bundle_archive.h b/framework/include/bundle_archive.h
deleted file mode 100644
index 1a9b2c4..0000000
--- a/framework/include/bundle_archive.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * bundle_archive.h
- *
- * \date Aug 8, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef BUNDLE_ARCHIVE_H_
-#define BUNDLE_ARCHIVE_H_
-
-#include "celix_types.h"
-
-#include <time.h>
-
-#include "bundle_revision.h"
-#include "bundle_state.h"
-#include "celix_errno.h"
-#include "celixbool.h"
-#include "framework_exports.h"
-#include "celix_log.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-celix_status_t bundleArchive_create(const char *archiveRoot, long id, const char *location, const char *inputFile,
- bundle_archive_pt *bundle_archive);
-
-celix_status_t bundleArchive_createSystemBundleArchive(bundle_archive_pt *bundle_archive);
-
-celix_status_t bundleArchive_recreate(const char *archiveRoot, bundle_archive_pt *bundle_archive);
-
-celix_status_t bundleArchive_destroy(bundle_archive_pt archive);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getId(bundle_archive_pt archive, long *id);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, const char **location);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, const char **archiveRoot);
-
-FRAMEWORK_EXPORT celix_status_t
-bundleArchive_revise(bundle_archive_pt archive, const char *location, const char *inputFile);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_rollbackRevise(bundle_archive_pt archive, bool *rolledback);
-
-FRAMEWORK_EXPORT celix_status_t
-bundleArchive_getRevision(bundle_archive_pt archive, long revNr, bundle_revision_pt *revision);
-
-FRAMEWORK_EXPORT celix_status_t
-bundleArchive_getCurrentRevision(bundle_archive_pt archive, bundle_revision_pt *revision);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getCurrentRevisionNumber(bundle_archive_pt archive, long *revisionNumber);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getRefreshCount(bundle_archive_pt archive, long *refreshCount);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_setRefreshCount(bundle_archive_pt archive);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_close(bundle_archive_pt archive);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_closeAndDelete(bundle_archive_pt archive);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_setLastModified(bundle_archive_pt archive, time_t lastModifiedTime);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getLastModified(bundle_archive_pt archive, time_t *lastModified);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_setPersistentState(bundle_archive_pt archive, bundle_state_e state);
-
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getPersistentState(bundle_archive_pt archive, bundle_state_e *state);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BUNDLE_ARCHIVE_H_ */