celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ejans...@apache.org
Subject [5/7] celix git commit: demo working again, unstable sadly
Date Wed, 13 Jul 2016 06:09:29 GMT
demo working again, unstable sadly


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5d64b63f
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5d64b63f
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5d64b63f

Branch: refs/heads/develop
Commit: 5d64b63f2face61b99add99bde2e0c3c1a236dbd
Parents: 514e274
Author: Ealanrian <erik@jansman.eu>
Authored: Tue Jul 12 16:07:43 2016 +0200
Committer: Ealanrian <erik@jansman.eu>
Committed: Tue Jul 12 16:07:43 2016 +0200

----------------------------------------------------------------------
 .../event_admin/private/src/event_impl.c        |   4 -
 .../event_admin/public/include/event_admin.h    |   7 +-
 .../event_admin/public/include/event_handler.h  |   3 +
 .../private/src/event_handler_impl.c            |  18 ++-
 event_admin/utils/CMakeLists.txt                |  27 ----
 event_admin/utils/private/src/event_impl.c      | 133 -------------------
 event_admin/utils/public/include/event.h        |  36 -----
 7 files changed, 22 insertions(+), 206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/5d64b63f/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
index 94818d9..aad9877 100644
--- a/event_admin/event_admin/private/src/event_impl.c
+++ b/event_admin/event_admin/private/src/event_impl.c
@@ -33,10 +33,6 @@
 #include "stddef.h"
 
 
-struct event {
-	const char *topic;
-	properties_pt properties;
-};
 
 celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, const char *topic, properties_pt
properties,
 									  event_pt *event) {

http://git-wip-us.apache.org/repos/asf/celix/blob/5d64b63f/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
index b338339..4955b54 100644
--- a/event_admin/event_admin/public/include/event_admin.h
+++ b/event_admin/event_admin/public/include/event_admin.h
@@ -26,7 +26,6 @@
 
 #ifndef EVENT_ADMIN_H_
 #define EVENT_ADMIN_H_
-/*#include "event.h"*/
 #include "celix_errno.h"
 
 #include "listener_hook_service.h"
@@ -34,7 +33,13 @@
 #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.

http://git-wip-us.apache.org/repos/asf/celix/blob/5d64b63f/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
index d7b71f6..5f76c6d 100644
--- a/event_admin/event_admin/public/include/event_handler.h
+++ b/event_admin/event_admin/public/include/event_handler.h
@@ -32,6 +32,9 @@ 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

http://git-wip-us.apache.org/repos/asf/celix/blob/5d64b63f/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
index 13b3c19..52ff1b7 100644
--- a/event_admin/event_handler/private/src/event_handler_impl.c
+++ b/event_admin/event_handler/private/src/event_handler_impl.c
@@ -54,19 +54,27 @@ celix_status_t eventHandlerCreate(bundle_context_pt context, event_handler_pt
*e
 celix_status_t eventHandlerHandleEvent(event_handler_pt *event_handler, event_pt event) {
 	celix_status_t status = CELIX_SUCCESS;
 	if (event != NULL) {
-        const char *topic = NULL;
-		status = (*event_handler)->event_admin_service->getTopic(&event, &topic);
+        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);
-		status = (*event_handler)->event_admin_service->getPropertyNames(&event, &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;
-			(*event_handler)->event_admin_service->getProperty(&event,key,&value);
+            value = properties_get((*event).properties, key);
+
 
 			logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] Key: %s value:
%s.", key, value);
 		}

http://git-wip-us.apache.org/repos/asf/celix/blob/5d64b63f/event_admin/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/event_admin/utils/CMakeLists.txt b/event_admin/utils/CMakeLists.txt
deleted file mode 100644
index 576dd08..0000000
--- a/event_admin/utils/CMakeLists.txt
+++ /dev/null
@@ -1,27 +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(APR REQUIRED)
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/event_admin/event_admin/public/include")
-include_directories(public/include)
-
-add_library(event_admin_utils STATIC private/src/event_impl.c)
-target_link_libraries(event_admin_utils ${APRUTIL_LIBRARY})
-#install(TARGETS event_admin_utils DESTINATION lib COMPONENT framework)
-#FILE(GLOB files "public/include/*.h")
-#INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)

http://git-wip-us.apache.org/repos/asf/celix/blob/5d64b63f/event_admin/utils/private/src/event_impl.c
----------------------------------------------------------------------
diff --git a/event_admin/utils/private/src/event_impl.c b/event_admin/utils/private/src/event_impl.c
deleted file mode 100644
index bd87358..0000000
--- a/event_admin/utils/private/src/event_impl.c
+++ /dev/null
@@ -1,133 +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 "event.h"
-//#include "event_constants.h"
-//#include "celix_errno.h"
-//#include "stddef.h"
-//#include <apr.h>
-//#include <apr_pools.h>
-//struct event {
-//	char *topic;
-//	properties_pt properties;
-//};
-//
-//celix_status_t createEvent(char *topic, properties_pt properties, apr_pool_t *pool, event_pt
*event){
-//	celix_status_t status = CELIX_SUCCESS;
-//
-//	*event= apr_palloc(pool,sizeof(**event));
-//	if(!*event){
-//	       status = CELIX_ENOMEM;
-//	}else {
-//		(*event)->topic = topic;
-//		(*event)->properties = properties;
-//		properties_set((*event)->properties, (char *)EVENT_TOPIC, topic);
-//	}
-//	return status;
-//}
-//
-//celix_status_t containsProperty(event_pt *event, char *property, bool *result){
-//	celix_status_t status = CELIX_SUCCESS;
-//	if((*event)==NULL || property == NULL){
-//		status = CELIX_BUNDLE_EXCEPTION;
-//	}else {
-//		char * propertyValue = properties_get((*event)->properties,property);
-//		if(propertyValue == NULL){
-//			(*result)= false;
-//		}else {
-//			(*result) = true;
-//		}
-//	}
-//	return status;
-//}
-//
-//celix_status_t 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 getProperty(event_pt *event, char *propertyKey,  char **propertyValue){
-//	celix_status_t status = CELIX_SUCCESS;
-//	*propertyValue = properties_get((*event)->properties,propertyKey);
-//
-//	return status;
-//}
-//
-//celix_status_t 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 getTopic(event_pt *event, char **topic){
-//	celix_status_t status = CELIX_SUCCESS;
-//	char *value;
-//	value = properties_get((*event)->properties,(char*) EVENT_TOPIC);
-//	*topic = value;
-//
-//	return status;
-//}
-//
-//celix_status_t hashCode(event_pt *event, int *hashCode){
-//	celix_status_t status = CELIX_SUCCESS;
-//	return status;
-//}
-//
-//celix_status_t matches(event_pt *event){
-//	celix_status_t status = CELIX_SUCCESS;
-//	return status;
-//}
-//
-//celix_status_t toString(event_pt *event, char *eventString){
-//	celix_status_t status = CELIX_SUCCESS;
-//	return status;
-//}
-//
-//
-//
-//
-//

http://git-wip-us.apache.org/repos/asf/celix/blob/5d64b63f/event_admin/utils/public/include/event.h
----------------------------------------------------------------------
diff --git a/event_admin/utils/public/include/event.h b/event_admin/utils/public/include/event.h
deleted file mode 100644
index 25a792d..0000000
--- a/event_admin/utils/public/include/event.h
+++ /dev/null
@@ -1,36 +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.h
- *
- *  \Created on: Jul 19, 2013
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-
-#ifndef EVENT_H_
-#define EVENT_H_
-#include "celix_errno.h"
-#include "properties.h"
-#include "array_list.h"
-
-
-
-#endif /* EVENT_H_ */


Mime
View raw message