incubator-celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1101360 [3/5] - in /incubator/celix/trunk: ./ .settings/ celix_test/ dependency_manager/ echo_service/client/ framework/ framework/private/include/ framework/private/src/ hello_world/ hello_world/root/ launcher/ mongoose/ mongoose/MANIFEST...
Date Tue, 10 May 2011 08:21:27 GMT
Modified: incubator/celix/trunk/launcher/launcher.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/launcher/launcher.c?rev=1101360&r1=1101359&r2=1101360&view=diff
==============================================================================
--- incubator/celix/trunk/launcher/launcher.c (original)
+++ incubator/celix/trunk/launcher/launcher.c Tue May 10 08:21:24 2011
@@ -26,6 +26,7 @@
 #include "headers.h"
 #include "bundle_context.h"
 #include "bundle.h"
+#include "linked_list_iterator.h"
 
 static void launcher_load_custom_bundles(void);
 void launcher_shutdown(int signal);
@@ -57,22 +58,40 @@ int main(void) {
     	linkedList_addElement(bundles, location);
     	result = strtok(NULL, delims);
     }
-    int i;
     // Update according to Felix Main
     // First install all bundles
     // Afterwards start them
+    ARRAY_LIST installed = arrayList_create();
     BUNDLE_CONTEXT context = bundle_getContext(framework->bundle);
-    for (i = 0; i < linkedList_size(bundles); i++) {
-    	char * location = (char *) linkedList_get(bundles, i);
+    LINKED_LIST_ITERATOR iter = linkedListIterator_create(bundles, 0);
+    while (linkedListIterator_hasNext(iter)) {
+    	char * location = linkedListIterator_next(iter);
     	BUNDLE current = bundleContext_installBundle(context, location);
-		startBundle(current, 0);
+    	arrayList_add(installed, current);
+    	linkedListIterator_remove(iter);
+    }
+    linkedListIterator_destroy(iter);
+    linkedList_destroy(bundles);
+
+    int i;
+    for (i = 0; i < arrayList_size(installed); i++) {
+    	BUNDLE bundle = (BUNDLE) arrayList_get(installed, i);
+		startBundle(bundle, 0);
     }
 
+    arrayList_destroy(installed);
+
+
     framework_waitForStop(framework);
+    framework_destroy(framework);
+    properties_destroy(config);
     return 0;
 }
 
 void launcher_shutdown(int signal) {
 	framework_stop(framework);
-	framework_waitForStop(framework);
+	if (framework_waitForStop(framework) != CELIX_SUCCESS) {
+		celix_log("Error waiting for stop.");
+	}
+	framework_destroy(framework);
 }

Added: incubator/celix/trunk/mongoose/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/mongoose/CMakeLists.txt?rev=1101360&view=auto
==============================================================================
--- incubator/celix/trunk/mongoose/CMakeLists.txt (added)
+++ incubator/celix/trunk/mongoose/CMakeLists.txt Tue May 10 08:21:24 2011
@@ -0,0 +1,24 @@
+# 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_library(mongoose STATIC mongoose.c)
+
+add_library(celix.mongoose SHARED activator)
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+target_link_libraries(celix.mongoose framework mongoose)
+
+bundle(celix.mongoose DIRECTORIES root)

Propchange: incubator/celix/trunk/mongoose/CMakeLists.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/celix/trunk/mongoose/MANIFEST/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/mongoose/MANIFEST/MANIFEST.MF?rev=1101360&view=auto
==============================================================================
--- incubator/celix/trunk/mongoose/MANIFEST/MANIFEST.MF (added)
+++ incubator/celix/trunk/mongoose/MANIFEST/MANIFEST.MF Tue May 10 08:21:24 2011
@@ -0,0 +1,3 @@
+Bundle-SymbolicName: celix.mongoose
+Bundle-Version: 1.0.0
+library: celix.mongoose

Propchange: incubator/celix/trunk/mongoose/MANIFEST/MANIFEST.MF
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/celix/trunk/mongoose/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/mongoose/activator.c?rev=1101360&view=auto
==============================================================================
--- incubator/celix/trunk/mongoose/activator.c (added)
+++ incubator/celix/trunk/mongoose/activator.c Tue May 10 08:21:24 2011
@@ -0,0 +1,69 @@
+/**
+ *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: Aug 20, 2010
+ *      Author: alexanderb
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <apr-1/apr_general.h>
+
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "mongoose.h"
+
+struct userData {
+	struct mg_context *ctx;
+};
+
+celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
+	*userData = apr_palloc(bundleContext_getMemoryPool(context), sizeof(struct userData));
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
+	struct userData * data = (struct userData *) userData;
+
+	BUNDLE b = bundleContext_getBundle(context);
+	char *entry = NULL;
+	bundle_getEntry(b, "root", &entry);
+	printf("Entry: %s\n", entry);
+
+	const char *options[] = {
+		"document_root", entry,
+		NULL
+	};
+	struct mg_context *ctx = mg_start(NULL, options);
+
+	printf("Mongoose startet: %p\n", ctx);
+
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
+	struct userData * data = (struct userData *) userData;
+	mg_stop(data->ctx);
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
+	return CELIX_SUCCESS;
+}

Propchange: incubator/celix/trunk/mongoose/activator.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message