You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2017/11/20 20:33:25 UTC
[28/46] celix git commit: CELIX-417: Initial refactoring for CMake
usage
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/dm_example_cxx/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/CMakeLists.txt b/examples/dm_example_cxx/CMakeLists.txt
index 9572142..1a47113 100644
--- a/examples/dm_example_cxx/CMakeLists.txt
+++ b/examples/dm_example_cxx/CMakeLists.txt
@@ -19,7 +19,6 @@ if (BUILD_DEPENDENCY_MANAGER_CXX)
${PROJECT_SOURCE_DIR}/dependency_manager/public/include
${PROJECT_SOURCE_DIR}/dependency_manager_cxx/include
${PROJECT_SOURCE_DIR}/utils/public/include
- ${PROJECT_SOURCE_DIR}/shell/public/include
${PROJECT_SOURCE_DIR}/log_service/public/include
api
)
@@ -33,10 +32,10 @@ if (BUILD_DEPENDENCY_MANAGER_CXX)
add_deploy("dm_example_cxx"
COPY
- CXX
+ CXX
BUNDLES
- shell
- shell_tui
+ Celix::shell
+ Celix::shell_tui
dm_shell
log_service
log_writer
@@ -56,7 +55,7 @@ if (BUILD_DEPENDENCY_MANAGER_CXX)
BUNDLES_DIR /usr/share/bundles
WORKDIR /workspace
BUNDLES
- shell
+ celix_shell
shell_tui
dm_shell
log_service
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/dm_example_cxx/phase1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase1/CMakeLists.txt b/examples/dm_example_cxx/phase1/CMakeLists.txt
index 3c0544a..728278b 100644
--- a/examples/dm_example_cxx/phase1/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase1/CMakeLists.txt
@@ -31,12 +31,12 @@ add_bundle(phase1_cxx
target_compile_options(phase1_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
IF(APPLE)
- target_link_libraries(phase1_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(phase1_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static Celix::shell_api)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase1_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase1_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api)
else()
- target_link_libraries(phase1_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase1_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive Celix::shell_api)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/dm_example_cxx/phase2a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2a/CMakeLists.txt b/examples/dm_example_cxx/phase2a/CMakeLists.txt
index 8528078..4e2e673 100644
--- a/examples/dm_example_cxx/phase2a/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase2a/CMakeLists.txt
@@ -14,12 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-
-include_directories(
- ../phase2/include
- ../api
-)
-
add_bundle(phase2a_cxx
SYMBOLIC_NAME phase2a_cxx
VERSION 0.0.1
@@ -28,15 +22,20 @@ add_bundle(phase2a_cxx
src/Phase2aCmp.cc
)
-target_compile_options(phase2a_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
+target_include_directories(phase2a_cxx PRIVATE
+ ../phase2/include
+ ../api
+)
+
+target_link_libraries(phase2a_cxx PRIVATE Celix::log_service_api)
IF(APPLE)
- target_link_libraries(phase2a_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(phase2a_cxx PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase2a_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase2a_cxx PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase2a_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase2a_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/dm_example_cxx/phase2b/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase2b/CMakeLists.txt b/examples/dm_example_cxx/phase2b/CMakeLists.txt
index 29ff664..cfbda7c 100644
--- a/examples/dm_example_cxx/phase2b/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase2b/CMakeLists.txt
@@ -15,12 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(
- ../phase2/include
- include
- ../api
-)
-
add_bundle(phase2b_cxx
SYMBOLIC_NAME phase2b_cxx
VERSION 0.0.1
@@ -28,16 +22,18 @@ add_bundle(phase2b_cxx
src/Phase2bActivator.cc
src/Phase2bCmp.cc
)
+target_link_libraries(phase2b_cxx PRIVATE Celix::log_service_api)
+target_include_directories(phase2b_cxx PRIVATE ../api ../phase2/include)
+
-target_compile_options(phase2b_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
IF(APPLE)
- target_link_libraries(phase2b_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(phase2b_cxx PRIVATE -Wl,-all_load Celix::dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase2b_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase2b_cxx PRIVATE -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase2b_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase2b_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive Celix::dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/dm_example_cxx/phase3/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3/CMakeLists.txt b/examples/dm_example_cxx/phase3/CMakeLists.txt
index 99c3a5b..a0f6973 100644
--- a/examples/dm_example_cxx/phase3/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase3/CMakeLists.txt
@@ -32,12 +32,12 @@ add_bundle(phase3_cxx
target_compile_options(phase3_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
IF(APPLE)
- target_link_libraries(phase3_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(phase3_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase3_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase3_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase3_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase3_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/dm_example_cxx/phase3_locking/CMakeLists.txt b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
index 07c9b54..956f6e1 100644
--- a/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
+++ b/examples/dm_example_cxx/phase3_locking/CMakeLists.txt
@@ -31,12 +31,12 @@ add_bundle(phase3_locking_cxx
target_compile_options(phase3_locking_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
IF(APPLE)
- target_link_libraries(phase3_locking_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(phase3_locking_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(phase3_locking_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase3_locking_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(phase3_locking_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(phase3_locking_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/embedding/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/embedding/CMakeLists.txt b/examples/embedding/CMakeLists.txt
index c7475e7..e39433a 100644
--- a/examples/embedding/CMakeLists.txt
+++ b/examples/embedding/CMakeLists.txt
@@ -18,4 +18,4 @@
add_executable(embedding private/src/main)
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(embedding celix_framework)
\ No newline at end of file
+target_link_libraries(embedding Celix::framework )
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/hello_world/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt
index 0ed7ed6..7cb590f 100644
--- a/examples/hello_world/CMakeLists.txt
+++ b/examples/hello_world/CMakeLists.txt
@@ -51,13 +51,13 @@ bundle_private_libs(hello
add_deploy(helloworld_byref
GROUP hello
- BUNDLES hello_export hello shell shell_tui
+ BUNDLES hello_export hello ${CELIX_SHELL_BUNDLE} ${CELIX_SHELL_TUI_BUNDLE}
)
add_deploy(helloworld_withcopy
GROUP hello
COPY #Ensures that bundles are copied in the deploy location
- BUNDLES hello_export hello shell shell_tui
+ BUNDLES hello_export hello ${SHELL_BUNDLE} ${SHELL_TUI_BUNDLE}
)
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/hello_world_test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/hello_world_test/CMakeLists.txt b/examples/hello_world_test/CMakeLists.txt
index 39198ed..08053e5 100644
--- a/examples/hello_world_test/CMakeLists.txt
+++ b/examples/hello_world_test/CMakeLists.txt
@@ -19,15 +19,18 @@
## NOTE Examples of using add_bundle and add_deploy and assorted commands ##
#############################################################################
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories(public/include)
-
add_bundle(hellotest1
VERSION "1.2"
SOURCES
private/src/activator
)
+target_include_directories(hellotest1 PRIVATE
+ ${PROJECT_SOURCE_DIR}/utils/public/include
+ public/include
+)
+
+
bundle_headers(hellotest1
"X-WebContent: web"
"X-MediaType: application/json"
@@ -72,6 +75,7 @@ add_library(hello2act SHARED
private/src/activator
)
set_library_version(hello2act "3.2.4") #sets VERSION prop to 3.2.4 and SOVERSION to 3
+target_link_libraries(hello2act PRIVATE Celix::framework )
add_bundle(hellotest2
VERSION "1.0.0" #can be the same as activator lib, but does not have to be
ACTIVATOR hello2act
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/log_service_example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/log_service_example/CMakeLists.txt b/examples/log_service_example/CMakeLists.txt
index 6b7e681..0363da3 100644
--- a/examples/log_service_example/CMakeLists.txt
+++ b/examples/log_service_example/CMakeLists.txt
@@ -17,20 +17,15 @@
#Importing and exporting libraries not (yet) work under OSX.
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("public/include")
-include_directories("${CMAKE_SOURCE_DIR}/log_service/public/include")
-
add_bundle(log_service_example
VERSION "1.0"
SOURCES
- private/src/activator.c
- ${CMAKE_SOURCE_DIR}/log_service/public/src/log_helper.c
+ src/activator.c
)
+target_include_directories(log_service_example PRIVATE src)
+target_link_libraries(log_service_example PRIVATE Celix::log_service_api Celix::log_helper)
add_deploy(log_example
GROUP log_service
- BUNDLES log_service_example log_service shell shell_tui
-)
-
-target_link_libraries(log_service_example celix_framework celix_utils)
\ No newline at end of file
+ BUNDLES log_service_example Celix::log_service Celix::shell Celix::shell_tui
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/log_service_example/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/log_service_example/private/src/activator.c b/examples/log_service_example/private/src/activator.c
deleted file mode 100644
index 75eaf59..0000000
--- a/examples/log_service_example/private/src/activator.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- * \date Sep 11, 2017
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include "bundle_activator.h"
-#include "log_helper.h"
-
-struct userData {
- pthread_t logger_thread;
- bool running;
- log_helper_pt log_helper;
-};
-
-static void *loggerThread(void *userData);
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- *userData = calloc(1, sizeof(struct userData));
- if (*userData != NULL) {
- struct userData * data = (struct userData *) *userData;
- status = logHelper_create(context, &data->log_helper);
- } else {
- status = CELIX_START_ERROR;
- }
- return status;
-}
-
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- struct userData * data = (struct userData *) userData;
- printf("Started log example\n");
- logHelper_start(data->log_helper);
- data->running = true;
- pthread_create(&data->logger_thread, NULL, loggerThread, data);
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- struct userData * data = (struct userData *) userData;
- printf("Stopping logger example\n");
- data->running = false;
- pthread_join(data->logger_thread, NULL);
- logHelper_stop(data->log_helper);
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- struct userData * data = (struct userData *) userData;
- logHelper_destroy(&data->log_helper);
- free(userData);
- return CELIX_SUCCESS;
-}
-
-static void *loggerThread(void *userData) {
- struct userData * data = (struct userData *) userData;
- while (data->running) {
- logHelper_log(data->log_helper, OSGI_LOGSERVICE_INFO, "My log message");
- sleep(1);
- }
- return NULL;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/log_service_example/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/log_service_example/src/activator.c b/examples/log_service_example/src/activator.c
new file mode 100644
index 0000000..75eaf59
--- /dev/null
+++ b/examples/log_service_example/src/activator.c
@@ -0,0 +1,85 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements. See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership. The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * activator.c
+ *
+ * \date Sep 11, 2017
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "bundle_activator.h"
+#include "log_helper.h"
+
+struct userData {
+ pthread_t logger_thread;
+ bool running;
+ log_helper_pt log_helper;
+};
+
+static void *loggerThread(void *userData);
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
+ *userData = calloc(1, sizeof(struct userData));
+ if (*userData != NULL) {
+ struct userData * data = (struct userData *) *userData;
+ status = logHelper_create(context, &data->log_helper);
+ } else {
+ status = CELIX_START_ERROR;
+ }
+ return status;
+}
+
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+ struct userData * data = (struct userData *) userData;
+ printf("Started log example\n");
+ logHelper_start(data->log_helper);
+ data->running = true;
+ pthread_create(&data->logger_thread, NULL, loggerThread, data);
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+ struct userData * data = (struct userData *) userData;
+ printf("Stopping logger example\n");
+ data->running = false;
+ pthread_join(data->logger_thread, NULL);
+ logHelper_stop(data->log_helper);
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+ struct userData * data = (struct userData *) userData;
+ logHelper_destroy(&data->log_helper);
+ free(userData);
+ return CELIX_SUCCESS;
+}
+
+static void *loggerThread(void *userData) {
+ struct userData * data = (struct userData *) userData;
+ while (data->running) {
+ logHelper_log(data->log_helper, OSGI_LOGSERVICE_INFO, "My log message");
+ sleep(1);
+ }
+ return NULL;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/mongoose/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/mongoose/CMakeLists.txt b/examples/mongoose/CMakeLists.txt
index f4250ef..118d923 100644
--- a/examples/mongoose/CMakeLists.txt
+++ b/examples/mongoose/CMakeLists.txt
@@ -37,6 +37,6 @@ add_bundle(mongoose
bundle_files(mongoose ${CMAKE_CURRENT_LIST_DIR}/root)
-target_link_libraries(mongoose celix_framework mongooselib ${LIBS})
+target_link_libraries(mongoose PRIVATE mongooselib ${LIBS})
-add_deploy("mongoose_deploy" BUNDLES shell shell_tui log_service mongoose)
+add_deploy("mongoose_deploy" BUNDLES Celix::shell Celix::shell_tui log_service mongoose)
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/service_hook_example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/service_hook_example/CMakeLists.txt b/examples/service_hook_example/CMakeLists.txt
index 8835a85..99e9b2a 100644
--- a/examples/service_hook_example/CMakeLists.txt
+++ b/examples/service_hook_example/CMakeLists.txt
@@ -15,23 +15,16 @@
# specific language governing permissions and limitations
# under the License.
-if(NOT APPLE)
-#Importing and exporting libraries not (yet) work under OSX.
-
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("public/include")
-
add_bundle(hook_example
- BUNDLE_SYMBOLICNAME "Hook_Example"
- VERSION "1.0.0"
- SOURCES
- private/src/activator
+ BUNDLE_SYMBOLICNAME "Hook_Example"
+ VERSION "1.0.0"
+ SOURCES
+ src/activator
)
-add_deploy("hook_service_example"
- BUNDLES
- shell
- shell_tui
- hook_example
-)
-endif()
+add_deploy(hook_service_example
+ BUNDLES
+ Celix::shell
+ Celix::shell_tui
+ hook_example
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/service_hook_example/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/service_hook_example/private/src/activator.c b/examples/service_hook_example/private/src/activator.c
deleted file mode 100644
index f2d2a15..0000000
--- a/examples/service_hook_example/private/src/activator.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- * \date Aug 20, 2010
- * \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 <stdio.h>
-
-#include "bundle_activator.h"
-#include "service_tracker_customizer.h"
-#include "service_tracker.h"
-#include "bundle_context.h"
-#include "listener_hook_service.h"
-#include "service_registry.h"
-
-struct userData {
- service_registration_pt hookReg;
- service_tracker_pt trackerBefore;
- service_tracker_pt trackerAfter;
- listener_hook_service_pt hookService;
-};
-
-
-celix_status_t tracker_added(void*hook, array_list_pt listeners) {
- for(unsigned int i = 0; i < arrayList_size(listeners); i++) {
- listener_hook_info_pt info = arrayList_get(listeners, i);
- printf("Added tracker for service %s\n", info->filter);
- }
-
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_removed(void*hook, array_list_pt listeners) {
- for(unsigned int i = 0; i < arrayList_size(listeners); i++) {
- listener_hook_info_pt info = arrayList_get(listeners, i);
- printf("Removed tracker for service %s\n", info->filter);
- }
-
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- *userData = malloc(sizeof(struct userData));
- if (*userData != NULL) {
-
- } else {
- status = CELIX_START_ERROR;
- }
- return status;
-}
-
-celix_status_t bundleActivator_start(void * handle, bundle_context_pt context) {
- printf("Starting hook example bundle\n");
- struct userData *userData = (struct userData*)handle;
-
- userData->trackerBefore = 0;
- serviceTracker_create(context, "MY_SERVICE_BEFORE_REGISTERING_HOOK", NULL, &userData->trackerBefore);
- serviceTracker_open(userData->trackerBefore);
-
- listener_hook_service_pt hookService = calloc(1, sizeof(*hookService));
- hookService->handle = userData;
- hookService->added = tracker_added;
- hookService->removed = tracker_removed;
-
- userData->hookService = hookService;
- userData->hookReg = NULL;
-
- printf("Registering hook service\n");
- bundleContext_registerService(context, OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, hookService, NULL, &userData->hookReg);
-
- printf("Unregistering hook service\n");
- serviceRegistration_unregister(userData->hookReg);
-
- printf("Re-Registering hook service\n");
- userData->hookReg = NULL;
- bundleContext_registerService(context, OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, hookService, NULL, &userData->hookReg);
-
- userData->trackerAfter = 0;
- serviceTracker_create(context, "MY_SERVICE_AFTER_REGISTERING_HOOK", NULL, &userData->trackerAfter);
- serviceTracker_open(userData->trackerAfter);
-
- sleep(1);
- printf("Closing tracker\n");
- serviceTracker_close(userData->trackerAfter);
- printf("Reopening tracker\n");
- serviceTracker_open(userData->trackerAfter);
-
- sleep(1);
- printf("Closing tracker\n");
- serviceTracker_close(userData->trackerAfter);
- printf("Reopening tracker\n");
- serviceTracker_open(userData->trackerAfter);
-
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * handle, bundle_context_pt context) {
- printf("Stopping hook example bundle\n");
- struct userData *userData = (struct userData*)handle;
-
- serviceTracker_close(userData->trackerAfter);
- serviceTracker_close(userData->trackerBefore);
- serviceTracker_destroy(userData->trackerAfter);
- serviceTracker_destroy(userData->trackerBefore);
-
- serviceRegistration_unregister(userData->hookReg);
- free(userData->hookService);
-
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * handle, bundle_context_pt context) {
- free(handle);
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/service_hook_example/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/service_hook_example/src/activator.c b/examples/service_hook_example/src/activator.c
new file mode 100644
index 0000000..f2d2a15
--- /dev/null
+++ b/examples/service_hook_example/src/activator.c
@@ -0,0 +1,137 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements. See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership. The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * activator.c
+ *
+ * \date Aug 20, 2010
+ * \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 <stdio.h>
+
+#include "bundle_activator.h"
+#include "service_tracker_customizer.h"
+#include "service_tracker.h"
+#include "bundle_context.h"
+#include "listener_hook_service.h"
+#include "service_registry.h"
+
+struct userData {
+ service_registration_pt hookReg;
+ service_tracker_pt trackerBefore;
+ service_tracker_pt trackerAfter;
+ listener_hook_service_pt hookService;
+};
+
+
+celix_status_t tracker_added(void*hook, array_list_pt listeners) {
+ for(unsigned int i = 0; i < arrayList_size(listeners); i++) {
+ listener_hook_info_pt info = arrayList_get(listeners, i);
+ printf("Added tracker for service %s\n", info->filter);
+ }
+
+ return CELIX_SUCCESS;
+}
+
+celix_status_t tracker_removed(void*hook, array_list_pt listeners) {
+ for(unsigned int i = 0; i < arrayList_size(listeners); i++) {
+ listener_hook_info_pt info = arrayList_get(listeners, i);
+ printf("Removed tracker for service %s\n", info->filter);
+ }
+
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
+ *userData = malloc(sizeof(struct userData));
+ if (*userData != NULL) {
+
+ } else {
+ status = CELIX_START_ERROR;
+ }
+ return status;
+}
+
+celix_status_t bundleActivator_start(void * handle, bundle_context_pt context) {
+ printf("Starting hook example bundle\n");
+ struct userData *userData = (struct userData*)handle;
+
+ userData->trackerBefore = 0;
+ serviceTracker_create(context, "MY_SERVICE_BEFORE_REGISTERING_HOOK", NULL, &userData->trackerBefore);
+ serviceTracker_open(userData->trackerBefore);
+
+ listener_hook_service_pt hookService = calloc(1, sizeof(*hookService));
+ hookService->handle = userData;
+ hookService->added = tracker_added;
+ hookService->removed = tracker_removed;
+
+ userData->hookService = hookService;
+ userData->hookReg = NULL;
+
+ printf("Registering hook service\n");
+ bundleContext_registerService(context, OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, hookService, NULL, &userData->hookReg);
+
+ printf("Unregistering hook service\n");
+ serviceRegistration_unregister(userData->hookReg);
+
+ printf("Re-Registering hook service\n");
+ userData->hookReg = NULL;
+ bundleContext_registerService(context, OSGI_FRAMEWORK_LISTENER_HOOK_SERVICE_NAME, hookService, NULL, &userData->hookReg);
+
+ userData->trackerAfter = 0;
+ serviceTracker_create(context, "MY_SERVICE_AFTER_REGISTERING_HOOK", NULL, &userData->trackerAfter);
+ serviceTracker_open(userData->trackerAfter);
+
+ sleep(1);
+ printf("Closing tracker\n");
+ serviceTracker_close(userData->trackerAfter);
+ printf("Reopening tracker\n");
+ serviceTracker_open(userData->trackerAfter);
+
+ sleep(1);
+ printf("Closing tracker\n");
+ serviceTracker_close(userData->trackerAfter);
+ printf("Reopening tracker\n");
+ serviceTracker_open(userData->trackerAfter);
+
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_stop(void * handle, bundle_context_pt context) {
+ printf("Stopping hook example bundle\n");
+ struct userData *userData = (struct userData*)handle;
+
+ serviceTracker_close(userData->trackerAfter);
+ serviceTracker_close(userData->trackerBefore);
+ serviceTracker_destroy(userData->trackerAfter);
+ serviceTracker_destroy(userData->trackerBefore);
+
+ serviceRegistration_unregister(userData->hookReg);
+ free(userData->hookService);
+
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * handle, bundle_context_pt context) {
+ free(handle);
+ return CELIX_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_c/CMakeLists.txt b/examples/services_example_c/CMakeLists.txt
index f6a5066..540399d 100644
--- a/examples/services_example_c/CMakeLists.txt
+++ b/examples/services_example_c/CMakeLists.txt
@@ -30,8 +30,8 @@ if (BUILD_DEPENDENCY_MANAGER)
GROUP services_example
COPY
BUNDLES
- shell
- shell_tui
+ Celix::shell
+ Celix::shell_tui
dm_shell
bar
foo1
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_c/bar/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_c/bar/CMakeLists.txt b/examples/services_example_c/bar/CMakeLists.txt
index 7ebb45c..2332931 100644
--- a/examples/services_example_c/bar/CMakeLists.txt
+++ b/examples/services_example_c/bar/CMakeLists.txt
@@ -28,12 +28,12 @@ add_bundle(bar
)
IF(APPLE)
- target_link_libraries(bar celix_framework -Wl,-all_load dependency_manager_static)
+ target_link_libraries(bar PRIVATE Celix::framework -Wl,-all_load dependency_manager_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(bar -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(bar -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive Celix::framework )
else()
- target_link_libraries(bar -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(bar -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive Celix::framework )
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_c/foo1/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_c/foo1/CMakeLists.txt b/examples/services_example_c/foo1/CMakeLists.txt
index 0d1b93c..d95546c 100644
--- a/examples/services_example_c/foo1/CMakeLists.txt
+++ b/examples/services_example_c/foo1/CMakeLists.txt
@@ -28,12 +28,12 @@ add_bundle(foo1
)
IF(APPLE)
- target_link_libraries(foo1 celix_framework -Wl,-all_load dependency_manager_static)
+ target_link_libraries(foo1 PRIVATE -Wl,-all_load dependency_manager_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(foo1 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(foo1 PRIVATE -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
else()
- target_link_libraries(foo1 -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(foo1 PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_c/foo2/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_c/foo2/CMakeLists.txt b/examples/services_example_c/foo2/CMakeLists.txt
index 1096c6c..b28e96c 100644
--- a/examples/services_example_c/foo2/CMakeLists.txt
+++ b/examples/services_example_c/foo2/CMakeLists.txt
@@ -28,12 +28,12 @@ add_bundle(foo2
)
IF(APPLE)
- target_link_libraries(foo2 celix_framework -Wl,-all_load dependency_manager_static)
+ target_link_libraries(foo2 PRIVATE -Wl,-all_load dependency_manager_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(foo2 -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(foo2 PRIVATE -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
else()
- target_link_libraries(foo2 -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(foo2 PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_cxx/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/CMakeLists.txt b/examples/services_example_cxx/CMakeLists.txt
index 6f45ef7..0d4e732 100644
--- a/examples/services_example_cxx/CMakeLists.txt
+++ b/examples/services_example_cxx/CMakeLists.txt
@@ -30,8 +30,8 @@ if (BUILD_DEPENDENCY_MANAGER_CXX)
GROUP services_example
COPY
BUNDLES
- shell
- shell_tui
+ Celix::shell
+ Celix::shell_tui
dm_shell
bar_cxx
foo_cxx
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_cxx/bar/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/bar/CMakeLists.txt b/examples/services_example_cxx/bar/CMakeLists.txt
index b3cdb07..ae91605 100644
--- a/examples/services_example_cxx/bar/CMakeLists.txt
+++ b/examples/services_example_cxx/bar/CMakeLists.txt
@@ -30,12 +30,12 @@ add_bundle(bar_cxx
target_compile_options(bar_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
IF(APPLE)
- target_link_libraries(bar_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(bar_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(bar_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(bar_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(bar_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(bar_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_cxx/baz/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/baz/CMakeLists.txt b/examples/services_example_cxx/baz/CMakeLists.txt
index 205c716..7e7acb1 100644
--- a/examples/services_example_cxx/baz/CMakeLists.txt
+++ b/examples/services_example_cxx/baz/CMakeLists.txt
@@ -30,12 +30,12 @@ add_bundle(baz_cxx
target_compile_options(baz_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
IF(APPLE)
- target_link_libraries(baz_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(baz_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(baz_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(baz_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(baz_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(baz_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/services_example_cxx/foo/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/services_example_cxx/foo/CMakeLists.txt b/examples/services_example_cxx/foo/CMakeLists.txt
index e01af00..384c276 100644
--- a/examples/services_example_cxx/foo/CMakeLists.txt
+++ b/examples/services_example_cxx/foo/CMakeLists.txt
@@ -30,12 +30,12 @@ add_bundle(foo_cxx
target_compile_options(foo_cxx PUBLIC -Wall -Wextra -Weffc++ -Werror)
IF(APPLE)
- target_link_libraries(foo_cxx celix_framework -Wl,-all_load dependency_manager_cxx_static)
+ target_link_libraries(foo_cxx PRIVATE -Wl,-all_load dependency_manager_cxx_static)
else()
if(ENABLE_ADDRESS_SANITIZER)
#With asan there can be undefined symbols
- target_link_libraries(foo_cxx -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(foo_cxx PRIVATE -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
else()
- target_link_libraries(foo_cxx -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive celix_framework)
+ target_link_libraries(foo_cxx PRIVATE -Wl,--no-undefined -Wl,--whole-archive dependency_manager_cxx_static -Wl,--no-whole-archive)
endif()
endif()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/whiteboard/CMakeLists.txt b/examples/whiteboard/CMakeLists.txt
deleted file mode 100644
index b904241..0000000
--- a/examples/whiteboard/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_subdirectory(publisherA)
-add_subdirectory(publisherB)
-add_subdirectory(tracker)
-add_subdirectory(tracker_depman)
-
-add_deploy("whiteboard" GROUP whiteboard BUNDLES tracker publisherA publisherB shell shell_tui log_service log_writer)
-add_deploy("whiteboard_dependency_manager" GROUP whiteboard BUNDLES tracker_depman publisherA publisherB shell shell_tui log_service log_writer dm_shell)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherA/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherA/CMakeLists.txt b/examples/whiteboard/publisherA/CMakeLists.txt
deleted file mode 100644
index a219360..0000000
--- a/examples/whiteboard/publisherA/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-add_bundle(publisherA VERSION 1.0.0 SOURCES private/src/activator private/src/publisher)
-include_directories("../publisherService/public/include")
-include_directories("../publisherService/private/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(publisherA celix_framework)
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherA/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherA/private/src/activator.c b/examples/whiteboard/publisherA/private/src/activator.c
deleted file mode 100644
index 663b0b9..0000000
--- a/examples/whiteboard/publisherA/private/src/activator.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <constants.h>
-
-#include "bundle_activator.h"
-#include "publisher_private.h"
-
-struct activatorData {
- publisher_service_pt ps;
- publisher_pt pub;
-
- service_registration_pt reg;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- *userData = calloc(1, sizeof(struct activatorData));
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- properties_pt props = NULL;
-
- struct activatorData * data = (struct activatorData *) userData;
- data->ps = calloc(1, sizeof(*(data->ps)));
- data->pub = calloc(1, sizeof(*(data->pub)));
- data->ps->invoke = publisher_invoke;
- data->ps->publisher = data->pub;
- data->reg = NULL;
-
- props = properties_create();
- properties_set(props, "id", "A");
- properties_set(props,(char*)OSGI_FRAMEWORK_SERVICE_RANKING , "10");
-
- status = bundleContext_registerService(context, PUBLISHER_NAME, data->ps, props, &data->reg);
- if (status != CELIX_SUCCESS) {
- char error[256];
- printf("Error: %s\n", celix_strerror(status, error, 256));
- }
-
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
-
- struct activatorData * data = (struct activatorData *) userData;
- serviceRegistration_unregister(data->reg);
-
- free(data->ps);
- free(data->pub);
-
- return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- free(userData);
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherA/private/src/publisher.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherA/private/src/publisher.c b/examples/whiteboard/publisherA/private/src/publisher.c
deleted file mode 100644
index 997befd..0000000
--- a/examples/whiteboard/publisherA/private/src/publisher.c
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * publisher.c
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdio.h>
-
-#include "publisher_private.h"
-
-void publisher_invoke(publisher_pt publisher, char * text) {
- printf("Publisher A received: %s\n", text);
-}
-
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherB/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherB/CMakeLists.txt b/examples/whiteboard/publisherB/CMakeLists.txt
deleted file mode 100644
index 74f0bb5..0000000
--- a/examples/whiteboard/publisherB/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(publisherB VERSION 1.0.0 SOURCES private/src/activator private/src/publisher)
-include_directories("../publisherService/public/include")
-include_directories("../publisherService/private/include")
-target_link_libraries(publisherB celix_framework)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherB/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherB/private/src/activator.c b/examples/whiteboard/publisherB/private/src/activator.c
deleted file mode 100644
index f5f1a2e..0000000
--- a/examples/whiteboard/publisherB/private/src/activator.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <constants.h>
-
-#include "bundle_activator.h"
-#include "publisher_private.h"
-
-struct activatorData {
- publisher_service_pt ps;
- publisher_pt pub;
-
- service_registration_pt reg;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- *userData = calloc(1, sizeof(struct activatorData));
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- properties_pt props = properties_create();
-
- struct activatorData * data = (struct activatorData *) userData;
- data->ps = calloc(1, sizeof(*(data->ps)));
- data->pub = calloc(1, sizeof(*(data->pub)));
- data->ps->invoke = publisher_invoke;
- data->ps->publisher = data->pub;
- data->reg = NULL;
-
- properties_set(props, "id", "B");
- properties_set(props,(char*)OSGI_FRAMEWORK_SERVICE_RANKING , "20");
-
- bundleContext_registerService(context, PUBLISHER_NAME, data->ps, props, &data->reg);
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
-
- struct activatorData * data = (struct activatorData *) userData;
- serviceRegistration_unregister(data->reg);
-
- free(data->pub);
- free(data->ps);
-
- return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- free(userData);
- return CELIX_SUCCESS;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherB/private/src/publisher.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherB/private/src/publisher.c b/examples/whiteboard/publisherB/private/src/publisher.c
deleted file mode 100644
index 87bb300..0000000
--- a/examples/whiteboard/publisherB/private/src/publisher.c
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * publisher.c
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdio.h>
-
-#include "publisher_private.h"
-
-void publisher_invoke(publisher_pt publisher, char * text) {
- printf("Publisher B received: %s\n", text);
-}
-
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherService/private/include/publisher_private.h
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherService/private/include/publisher_private.h b/examples/whiteboard/publisherService/private/include/publisher_private.h
deleted file mode 100644
index 19c524d..0000000
--- a/examples/whiteboard/publisherService/private/include/publisher_private.h
+++ /dev/null
@@ -1,38 +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.
- */
-/*
- * publisher_private.h
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PUBLISHER_PRIVATE_H_
-#define PUBLISHER_PRIVATE_H_
-
-#include "publisher.h"
-
-struct publisher {
- void *data;
-};
-
-void publisher_invoke(publisher_pt publisher, char * text);
-
-#endif /* PUBLISHER_PRIVATE_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/publisherService/public/include/publisher.h
----------------------------------------------------------------------
diff --git a/examples/whiteboard/publisherService/public/include/publisher.h b/examples/whiteboard/publisherService/public/include/publisher.h
deleted file mode 100644
index 9b18429..0000000
--- a/examples/whiteboard/publisherService/public/include/publisher.h
+++ /dev/null
@@ -1,42 +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.
- */
-/*
- * publisher.h
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PUBLISHER_H_
-#define PUBLISHER_H_
-
-#define PUBLISHER_NAME "Publisher"
-
-typedef struct publisher * publisher_pt;
-
-struct publisherService {
- publisher_pt publisher;
- void (*invoke)(publisher_pt pub, char * text);
-};
-
-typedef struct publisherService * publisher_service_pt;
-
-
-#endif /* PUBLISHER_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/tracker/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker/CMakeLists.txt b/examples/whiteboard/tracker/CMakeLists.txt
deleted file mode 100644
index c44b206..0000000
--- a/examples/whiteboard/tracker/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-add_bundle(tracker VERSION 1.0.0 SOURCES private/src/activator)
-include_directories("../publisherService/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(tracker celix_framework)
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/tracker/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker/private/src/activator.c b/examples/whiteboard/tracker/private/src/activator.c
deleted file mode 100644
index db5f3fc..0000000
--- a/examples/whiteboard/tracker/private/src/activator.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * activator.c
- *
- * \date Aug 23, 2010
- * \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 "celixbool.h"
-
-#include "bundle_activator.h"
-#include "publisher.h"
-#include "service_tracker.h"
-
-struct data {
- bundle_context_pt context;
- service_tracker_pt tracker;
- array_list_pt publishers;
- pthread_t sender;
- bool running;
-};
-
-static void *trk_send(void *handle) {
- struct data * data = (struct data *) handle;
- while (data->running) {
- int i;
- for (i = 0; i < arrayList_size(data->publishers); i++) {
- publisher_service_pt pub = arrayList_get(data->publishers, i);
- pub->invoke(pub->publisher, "test");
- }
- usleep(1000000);
- }
- pthread_exit(NULL);
- return NULL;
-}
-
-celix_status_t addingServ(void * handle, service_reference_pt ref, void **service) {
- struct data * data = (struct data *) handle;
-
- printf("Adding\n");
- bundleContext_getService(data->context, ref, service);
-
- return CELIX_SUCCESS;
-}
-
-celix_status_t addedServ(void * handle, service_reference_pt ref, void * service) {
- struct data * data = (struct data *) handle;
- arrayList_add(data->publishers, service);
- printf("Added %p\n", service);
- return CELIX_SUCCESS;
-}
-
-celix_status_t modifiedServ(void * handle, service_reference_pt ref, void * service) {
- printf("Modified\n");
- return CELIX_SUCCESS;
-}
-
-celix_status_t removedServ(void * handle, service_reference_pt ref, void * service) {
- struct data * data = (struct data *) handle;
- arrayList_removeElement(data->publishers, service);
- printf("Removed %p\n", service);
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- *userData = calloc(1, sizeof(struct data));
- ((struct data *) (*userData))->publishers = NULL;
- arrayList_create(&((struct data *) (*userData))->publishers);
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct data * data = (struct data *) userData;
- service_tracker_customizer_pt cust = NULL;
- service_tracker_pt tracker = NULL;
- data->context = context;
- serviceTrackerCustomizer_create(data, addingServ, addedServ, modifiedServ, removedServ, &cust);
- serviceTracker_create(context, (char *) PUBLISHER_NAME, cust, &tracker);
- data->tracker = tracker;
- serviceTracker_open(tracker);
- data->running = true;
- pthread_create(&data->sender, NULL, trk_send, data);
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct data * data = (struct data *) userData;
-
- printf("Stop\n");
- serviceTracker_close(data->tracker);
- data->running = false;
- pthread_join(data->sender, NULL);
-
- return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct data * data = (struct data *) userData;
-
- arrayList_destroy(data->publishers);
-
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/tracker_depman/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/CMakeLists.txt b/examples/whiteboard/tracker_depman/CMakeLists.txt
deleted file mode 100644
index 3bd5942..0000000
--- a/examples/whiteboard/tracker_depman/CMakeLists.txt
+++ /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.
-
-add_bundle(tracker_depman VERSION 1.0.0 SOURCES
- private/src/dependency_activator
- private/src/tracker
-
- private/include/tracker.h
-)
-include_directories("private/include")
-include_directories("${PROJECT_SOURCE_DIR}/dependency_manager/public/include")
-#include_directories("${PROJECT_SOURCE_DIR}/dependency_manager/private/include")
-include_directories("../publisherService/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-
-# Use some magic to include all symbols of the static library
-IF(APPLE)
-target_link_libraries(tracker_depman celix_framework -Wl,-all_load dependency_manager_static)
-else()
-target_link_libraries(tracker_depman -Wl,--whole-archive dependency_manager_static -Wl,--no-whole-archive celix_framework)
-ENDIF()
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/tracker_depman/private/include/tracker.h
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/include/tracker.h b/examples/whiteboard/tracker_depman/private/include/tracker.h
deleted file mode 100644
index 55438d2..0000000
--- a/examples/whiteboard/tracker_depman/private/include/tracker.h
+++ /dev/null
@@ -1,63 +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.
- */
-/*
- * tracker.h
- *
- * \date Mar 7, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef TRACKER_H_
-#define TRACKER_H_
-
-#include "dm_component.h"
-#include "log_service.h"
-
-struct data {
- dm_component_pt service;
- dm_service_dependency_pt dep;
- dm_service_dependency_pt dep2;
- bundle_context_pt context;
- array_list_pt publishers;
- pthread_t sender;
- bool running;
- log_service_pt logger;
-
- celix_thread_mutex_t logger_lock;
- celix_thread_mutex_t publisher_lock;
-};
-
-celix_status_t tracker_setServ(void * handle, service_reference_pt ref, const void * service);
-celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, const void * service);
-celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, const void * service);
-celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, const void * service);
-
-celix_status_t tracker_setLog(void * handle, service_reference_pt ref, const void * service);
-celix_status_t tracker_addLog(void * handle, service_reference_pt ref, const void * service);
-celix_status_t tracker_modifiedLog(void * handle, service_reference_pt ref, const void * service);
-celix_status_t tracker_removeLog(void * handle, service_reference_pt ref, const void * service);
-
-celix_status_t service_init(void * userData);
-celix_status_t service_start(void * userData);
-celix_status_t service_stop(void * userData);
-celix_status_t service_deinit(void * userData);
-
-
-#endif /* TRACKER_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
deleted file mode 100644
index 9ac295d..0000000
--- a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
+++ /dev/null
@@ -1,116 +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.
- */
-/*
- * dependency_activator.c
- *
- * \date Aug 23, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include "celixbool.h"
-
-#include "dm_activator.h"
-#include "publisher.h"
-#include "tracker.h"
-
-celix_status_t dm_create(bundle_context_pt context, void **userData) {
- printf("Create\n");
- struct data * data = malloc(sizeof(*data));
- data->publishers = NULL;
- arrayList_create(&data->publishers);
- data->context = NULL;
- data->running = false;
- data->sender = 0;
- data->service = NULL;
- data->logger = NULL;
- *userData = data;
- return CELIX_SUCCESS;
-}
-
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- printf("Init\n");
- struct data * data = (struct data *) userData;
- dm_component_pt service = NULL;
- dm_service_dependency_pt dep1 = NULL;
- dm_service_dependency_pt dep2 = NULL;
-
- data->context = context;
-
- component_create(context, "ExampleCmp", &service);
- component_setImplementation(service, data);
- component_setCallbacks(service, service_init, service_start, service_stop, service_deinit);
-
- serviceDependency_create(&dep1);
- serviceDependency_setRequired(dep1, true);
- serviceDependency_setService(dep1, PUBLISHER_NAME, NULL, "(|(id=A)(id=B))");
- serviceDependency_setCallbacksWithServiceReference(dep1, NULL /*tracker_setServ*/, tracker_addedServ, tracker_modifiedServ, tracker_removedServ, NULL);
- component_addServiceDependency(service, dep1);
-
- serviceDependency_create(&dep2);
- serviceDependency_setRequired(dep2, false);
- serviceDependency_setService(dep2, (char *) OSGI_LOGSERVICE_NAME, NULL, NULL);
- serviceDependency_setCallbacksWithServiceReference(dep2, NULL /*tracker_setLog*/, tracker_addLog, tracker_modifiedLog, tracker_removeLog, NULL);
- serviceDependency_setAutoConfigure(dep2, &data->logger_lock, (const void **) &data->logger);
- component_addServiceDependency(service, dep2);
-
- data->service = service;
- data->dep = dep1;
- data->dep2 = dep2;
-
- dependencyManager_add(manager, service);
-
- return CELIX_SUCCESS;
-}
-
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
- struct data * data = (struct data *) userData;
-
- arrayList_destroy(data->publishers);
- data->publishers = NULL;
- free(data);
- data = NULL;
- return CELIX_SUCCESS;
-}
-
-//int count;
-//
-//void lock(int state) {
-// pthread_mutex_t lock;
-// if (state == 1) {
-// if (count > 0) {
-// count++;
-// } else {
-// pthread_mutex_lock(&lock);
-// }
-// } else {
-// pthread_mutex_lock(&lock);
-// }
-//}
-//
-//void unlcok(int state) {
-// if (state == 1) {
-// if (count-- == 0) {
-// pthread_mutex_unlock(&lock);
-// }
-// } else {
-// pthread_mutex_unlock(&lock);
-// }
-//}
http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/examples/whiteboard/tracker_depman/private/src/tracker.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/src/tracker.c b/examples/whiteboard/tracker_depman/private/src/tracker.c
deleted file mode 100644
index d38abb9..0000000
--- a/examples/whiteboard/tracker_depman/private/src/tracker.c
+++ /dev/null
@@ -1,142 +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.
- */
-/*
- * tracker.c
- *
- * \date Mar 7, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "celixbool.h"
-
-#include "publisher.h"
-#include "tracker.h"
-
-static void *dp_send(void *handle) {
- struct data * data = (struct data *) handle;
- while (data->running) {
- printf("Running\n");
- int i;
- // lock
- for (i = 0; i < arrayList_size(data->publishers); i++) {
- publisher_service_pt pub = (publisher_service_pt) arrayList_get(data->publishers, i);
- pub->invoke(pub->publisher, "Tracker message");
- celixThreadMutex_lock(&data->logger_lock);
- printf("%p\n", data->logger);
- if (data->logger != NULL) {
- data->logger->log(data->logger->logger, OSGI_LOGSERVICE_INFO, "Sending message to publisher");
- }
- celixThreadMutex_unlock(&data->logger_lock);
- }
- // lock
- usleep(1000000);
- }
- pthread_exit(NULL);
- return NULL;
-}
-
-celix_status_t service_init(void * userData) {
- fprintf(stderr, "Service init");
- return CELIX_SUCCESS;
-}
-
-celix_status_t service_start(void * userData) {
- struct data * data = (struct data *) userData;
- fprintf(stderr, "Service started\n");
- data->running = true;
- pthread_create(&data->sender, NULL, dp_send, data);
- return CELIX_SUCCESS;
-}
-
-celix_status_t service_stop(void * userData) {
- struct data * data = (struct data *) userData;
- fprintf(stderr, "Service stopped\n");
- data->running = false;
- pthread_join(data->sender, NULL);
- return CELIX_SUCCESS;
-}
-
-celix_status_t service_deinit(void * userData) {
- fprintf(stderr, "Service deinit\n");
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_setServ(void * handle, service_reference_pt ref, const void * service) {
- printf("Service Set %p\n", service);
- return CELIX_SUCCESS;
-}
-
-
-celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, const void * service) {
- struct data * data = (struct data *) handle;
- arrayList_add(data->publishers, (void*)service);
- printf("Service Added %p\n", service);
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, const void * service) {
- printf("Service Changed\n");
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, const void * service) {
- struct data * data = (struct data *) handle;
- arrayList_removeElement(data->publishers, (void*) service);
- printf("Service Removed\n");
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_setLog(void *handle, service_reference_pt ref, const void *service) {
- struct data * data = (struct data *) handle;
-
- printf("SET log %p\n", service);
- if(service) {
- data->logger = (log_service_pt)service;
- ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "SET log");
- }
- fprintf(stderr, "SET end %p\n", service);
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_addLog(void *handle, service_reference_pt ref, const void *service) {
- struct data * data = (struct data *) handle;
- printf("Add log %p\n", service);
- data->logger = (log_service_pt)service;
- ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_modifiedLog(void *handle, service_reference_pt ref, const void *service) {
- struct data * data = (struct data *) handle;
- printf("Modify log\n");
- data->logger = (void*)service;
- ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
- return CELIX_SUCCESS;
-}
-
-celix_status_t tracker_removeLog(void *handle, service_reference_pt ref, const void *service) {
- struct data * data = (struct data *) handle;
- data->logger = NULL;
- printf("Remove log\n");
- return CELIX_SUCCESS;
-}