Author: abroekhuis
Date: Mon May 16 13:53:20 2011
New Revision: 1103737

URL: http://svn.apache.org/viewvc?rev=1103737&view=rev
Log:
Updated APR usage

Modified:
    incubator/celix/trunk/Hello World.launch
    incubator/celix/trunk/framework/private/include/bundle.h
    incubator/celix/trunk/framework/private/include/bundle_cache.h
    incubator/celix/trunk/framework/private/include/headers.h
    incubator/celix/trunk/framework/private/src/bundle.c
    incubator/celix/trunk/framework/private/src/bundle_archive.c
    incubator/celix/trunk/framework/private/src/bundle_cache.c
    incubator/celix/trunk/framework/private/src/bundle_context.c
    incubator/celix/trunk/framework/private/src/bundle_revision.c
    incubator/celix/trunk/framework/private/src/filter.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/hello_world/activator.c

Modified: incubator/celix/trunk/Hello World.launch
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/Hello%20World.launch?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/Hello World.launch (original)
+++ incubator/celix/trunk/Hello World.launch Mon May 16 13:53:20 2011
@@ -13,6 +13,7 @@
 <booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
 <listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
 <stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
 <stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
 <booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
 <booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>

Modified: incubator/celix/trunk/framework/private/include/bundle.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle.h?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle.h Mon May 16 
13:53:20 2011
@@ -32,7 +32,7 @@
 #include "celix_errno.h"
 
 celix_status_t bundle_create(BUNDLE * bundle, apr_pool_t *mp);
-celix_status_t bundle_createFromArchive(BUNDLE * bundle, FRAMEWORK framework, 
BUNDLE_ARCHIVE archive);
+celix_status_t bundle_createFromArchive(BUNDLE * bundle, FRAMEWORK framework, 
BUNDLE_ARCHIVE archive, apr_pool_t *bundlePool);
 celix_status_t bundle_destroy(BUNDLE bundle);
 
 bool bundle_isSystemBundle(BUNDLE bundle);

Modified: incubator/celix/trunk/framework/private/include/bundle_cache.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_cache.h?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_cache.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_cache.h Mon May 16 
13:53:20 2011
@@ -34,7 +34,7 @@ typedef struct bundleCache * BUNDLE_CACH
 
 BUNDLE_CACHE bundleCache_create(PROPERTIES configurationMap, apr_pool_t *mp);
 ARRAY_LIST bundleCache_getArchives(BUNDLE_CACHE cache);
-BUNDLE_ARCHIVE bundleCache_createArchive(BUNDLE_CACHE cache, long id, char * 
location);
+BUNDLE_ARCHIVE bundleCache_createArchive(BUNDLE_CACHE cache, long id, char * 
location, apr_pool_t *bundlePool);
 void bundleCache_delete(BUNDLE_CACHE cache);
 
 

Modified: incubator/celix/trunk/framework/private/include/headers.h
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/headers.h?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/headers.h (original)
+++ incubator/celix/trunk/framework/private/include/headers.h Mon May 16 
13:53:20 2011
@@ -97,6 +97,7 @@ struct bundle {
        // MODULE module;
        ARRAY_LIST modules;
        MANIFEST manifest;
+       apr_pool_t *memoryPool;
 
        pthread_mutex_t lock;
        int lockCount;

Modified: incubator/celix/trunk/framework/private/src/bundle.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Mon May 16 13:53:20 
2011
@@ -42,6 +42,7 @@ celix_status_t bundle_create(BUNDLE * bu
                return CELIX_ENOMEM;
        }
        BUNDLE_ARCHIVE archive = bundleArchive_createSystemBundleArchive(mp);
+       (*bundle)->memoryPool = mp;
        (*bundle)->archive = archive;
        (*bundle)->activator = NULL;
        (*bundle)->context = NULL;
@@ -64,11 +65,12 @@ celix_status_t bundle_create(BUNDLE * bu
        return CELIX_SUCCESS;
 }
 
-celix_status_t bundle_createFromArchive(BUNDLE * bundle, FRAMEWORK framework, 
BUNDLE_ARCHIVE archive) {
+celix_status_t bundle_createFromArchive(BUNDLE * bundle, FRAMEWORK framework, 
BUNDLE_ARCHIVE archive, apr_pool_t *bundlePool) {
        *bundle = (BUNDLE) malloc(sizeof(**bundle));
        if (*bundle == NULL) {
                return CELIX_ENOMEM;
        }
+       (*bundle)->memoryPool = bundlePool;
        (*bundle)->archive = archive;
        (*bundle)->activator = NULL;
        (*bundle)->context = NULL;

Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Mon May 16 
13:53:20 2011
@@ -26,8 +26,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-//#include <dirent.h>
-//#include <sys/stat.h>
 
 #include "bundle_archive.h"
 #include "bundle_revision.h"
@@ -39,7 +37,7 @@
 struct bundleArchive {
        long id;
        char * location;
-       DIR * archiveRootDir;
+       apr_dir_t * archiveRootDir;
        char * archiveRoot;
        LINKED_LIST revisions;
        long refreshCount;
@@ -98,7 +96,8 @@ BUNDLE_ARCHIVE bundleArchive_create(char
 
 celix_status_t bundleArchive_destroy(BUNDLE_ARCHIVE archive) {
        if (archive->archiveRootDir != NULL) {
-               closedir(archive->archiveRootDir);
+               // closedir(archive->archiveRootDir);
+               apr_dir_close(archive->archiveRootDir);
        }
        if (archive->archiveRoot != NULL) {
                free(archive->archiveRoot);
@@ -121,7 +120,7 @@ celix_status_t bundleArchive_destroy(BUN
 BUNDLE_ARCHIVE bundleArchive_recreate(char * archiveRoot, apr_pool_t *mp) {
        BUNDLE_ARCHIVE archive = (BUNDLE_ARCHIVE) malloc(sizeof(*archive));
        archive->archiveRoot = archiveRoot;
-       archive->archiveRootDir = opendir(archiveRoot);
+       apr_dir_open(&archive->archiveRootDir, archiveRoot, mp);
        archive->id = -1;
        archive->persistentState = -1;
        archive->location = NULL;
@@ -175,11 +174,15 @@ char * bundleArchive_getLocation(BUNDLE_
        char bundleLocation[strlen(archive->archiveRoot) + 16];
        strcpy(bundleLocation,archive->archiveRoot);
        strcat(bundleLocation, "/bundle.location");
-       FILE * bundleLocationFile = fopen(bundleLocation, "r");
+       apr_file_t *bundleLocationFile;
+       apr_status_t rv;
+       if ((rv = apr_file_open(&bundleLocationFile, bundleLocation, 
APR_FOPEN_READ, APR_OS_DEFAULT, archive->mp)) != APR_SUCCESS) {
+
+       }
 
        char location[256];
-       fgets (location , sizeof(location) , bundleLocationFile);
-       fclose(bundleLocationFile);
+       apr_file_gets (location , sizeof(location) , bundleLocationFile);
+       apr_file_close(bundleLocationFile);
 
        return strdup(location);
 }
@@ -209,10 +212,11 @@ BUNDLE_STATE bundleArchive_getPersistent
        char persistentStateLocation[strlen(archive->archiveRoot) + 14];
        strcpy(persistentStateLocation, archive->archiveRoot);
        strcat(persistentStateLocation, "/bundle.state");
-       FILE * persistentStateLocationFile = fopen(persistentStateLocation, 
"r");
+       apr_file_t *persistentStateLocationFile;
+       apr_file_open(&persistentStateLocationFile, persistentStateLocation, 
APR_FOPEN_READ, APR_OS_DEFAULT, archive->mp);
        char state[256];
-       fgets (state , sizeof(state) , persistentStateLocationFile);
-       fclose(persistentStateLocationFile);
+       apr_file_gets(state , sizeof(state) , persistentStateLocationFile);
+       apr_file_close(persistentStateLocationFile);
 
        if (state != NULL && (strcmp(state, "active") == 0)) {
                archive->persistentState = BUNDLE_ACTIVE;
@@ -231,7 +235,8 @@ void bundleArchive_setPersistentState(BU
        char persistentStateLocation[strlen(archive->archiveRoot) + 14];
        strcpy(persistentStateLocation, archive->archiveRoot);
        strcat(persistentStateLocation, "/bundle.state");
-       FILE * persistentStateLocationFile = fopen(persistentStateLocation, 
"w");
+       apr_file_t *persistentStateLocationFile;
+       apr_file_open(&persistentStateLocationFile, persistentStateLocation, 
APR_FOPEN_WRITE, APR_OS_DEFAULT, archive->mp);
        char * s;
        switch (state) {
                case BUNDLE_ACTIVE:
@@ -247,8 +252,8 @@ void bundleArchive_setPersistentState(BU
                        s = "installed";
                        break;
        }
-       fprintf(persistentStateLocationFile, "%s", s);
-       fclose(persistentStateLocationFile);
+       apr_file_printf(persistentStateLocationFile, "%s", s);
+       apr_file_close(persistentStateLocationFile);
 
        archive->persistentState = state;
 }
@@ -261,11 +266,13 @@ long bundleArchive_getRefreshCount(BUNDL
        char refreshCounter[strlen(archive->archiveRoot) + 17];
        strcpy(refreshCounter,archive->archiveRoot);
        strcat(refreshCounter, "/refresh.counter");
-       FILE * refreshCounterFile = fopen(refreshCounter, "r");
+       apr_file_t * refreshCounterFile;
+       apr_file_open(&refreshCounterFile, refreshCounter, APR_FOPEN_READ, 
APR_OS_DEFAULT, archive->mp);
+
        if (refreshCounterFile != NULL) {
                char counterStr[256];
-               fgets (counterStr , sizeof(counterStr) , refreshCounterFile);
-               fclose(refreshCounterFile);
+               apr_file_gets(counterStr , sizeof(counterStr) , 
refreshCounterFile);
+               apr_file_close(refreshCounterFile);
                sscanf(counterStr, "%ld", &archive->refreshCount);
        } else {
                archive->refreshCount = 0;
@@ -277,10 +284,11 @@ void bundleArchive_setRefreshCount(BUNDL
        char refreshCounter[strlen(archive->archiveRoot) + 17];
        strcpy(refreshCounter, archive->archiveRoot);
        strcat(refreshCounter, "/refresh.counter");
-       FILE * refreshCounterFile = fopen(refreshCounter, "w");
+       apr_file_t * refreshCounterFile;
+       apr_file_open(&refreshCounterFile, refreshCounter, APR_FOPEN_WRITE, 
APR_OS_DEFAULT, archive->mp);
 
-       fprintf(refreshCounterFile, "%ld", archive->refreshCount);
-       fclose(refreshCounterFile);
+       apr_file_printf(refreshCounterFile, "%ld", archive->refreshCount);
+       apr_file_close(refreshCounterFile);
 }
 
 time_t bundleArchive_getLastModified(BUNDLE_ARCHIVE archive) {
@@ -296,7 +304,6 @@ void bundleArchive_setLastModified(BUNDL
 }
 
 time_t bundleArchive_readLastModified(BUNDLE_ARCHIVE archive) {
-       printf("Read time\n");
        char lastModified[strlen(archive->archiveRoot) + 21];
        sprintf(lastModified, "%s/bundle.lastmodified", archive->archiveRoot);
 
@@ -370,10 +377,11 @@ char * bundleArchive_getRevisionLocation
        char revisionLocation[256];
        sprintf(revisionLocation, "%s/version%ld.%ld/revision.location", 
archive->archiveRoot, bundleArchive_getRefreshCount(archive), revNr);
 
-       FILE * revisionLocationFile = fopen(revisionLocation, "r");
+       apr_file_t * revisionLocationFile;
+       apr_file_open(&revisionLocationFile, revisionLocation, APR_FOPEN_READ, 
APR_OS_DEFAULT, archive->mp);
        char location[256];
-       fgets (location , sizeof(location) , revisionLocationFile);
-       fclose(revisionLocationFile);
+       apr_file_gets (location , sizeof(location) , revisionLocationFile);
+       apr_file_close(revisionLocationFile);
 
        return strdup(location);
 }
@@ -382,9 +390,10 @@ void bundleArchive_setRevisionLocation(B
        char revisionLocation[256];
        sprintf(revisionLocation, "%s/version%ld.%ld/revision.location", 
archive->archiveRoot, bundleArchive_getRefreshCount(archive), revNr);
 
-       FILE * revisionLocationFile = fopen(revisionLocation, "w");
-       fprintf(revisionLocationFile, "%s", location);
-       fclose(revisionLocationFile);
+       apr_file_t * revisionLocationFile;
+       apr_file_open(&revisionLocationFile, revisionLocation, APR_FOPEN_WRITE, 
APR_OS_DEFAULT, archive->mp);
+       apr_file_printf(revisionLocationFile, "%s", location);
+       apr_file_close(revisionLocationFile);
 }
 
 void bundleArchive_close(BUNDLE_ARCHIVE archive) {
@@ -403,7 +412,7 @@ void bundleArchive_initialize(BUNDLE_ARC
        }
 
        apr_dir_make(archive->archiveRoot, APR_UREAD|APR_UWRITE|APR_UEXECUTE, 
archive->mp);
-       archive->archiveRootDir = opendir(archive->archiveRoot);
+       apr_dir_open(&archive->archiveRootDir, archive->archiveRoot, 
archive->mp);
 
        char bundleId[strlen(archive->archiveRoot) + 10];
        strcpy(bundleId, archive->archiveRoot);
@@ -413,10 +422,6 @@ void bundleArchive_initialize(BUNDLE_ARC
        apr_file_printf(bundleIdFile, "%ld", archive->id);
        apr_file_close(bundleIdFile);
 
-//     FILE * bundleIdFile = fopen(bundleId, "w");
-//     fprintf(bundleIdFile, "%ld", archive->id);
-//     fclose(bundleIdFile);
-
        char bundleLocation[strlen(archive->archiveRoot) + 16];
        strcpy(bundleLocation,archive->archiveRoot);
        strcat(bundleLocation, "/bundle.location");
@@ -425,10 +430,6 @@ void bundleArchive_initialize(BUNDLE_ARC
        apr_file_printf(bundleLocationFile, "%s", archive->location);
        apr_file_close(bundleLocationFile);
 
-//     FILE * bundleLocationFile = fopen(bundleLocation, "w");
-//     fprintf(bundleLocationFile, "%s", archive->location);
-//     fclose(bundleLocationFile);
-
        bundleArchive_writeLastModified(archive);
 }
 
@@ -437,22 +438,14 @@ void bundleArchive_deleteTree(char * dir
        apr_dir_open(&dir, directory, mp);
        apr_finfo_t dp;
        while (apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) {
-
-       //DIR * dir = opendir(directory);
-//     struct dirent * dp;
-//     while ((dp = readdir(dir))) {
                if ((strcmp((dp.name), ".") != 0) && (strcmp((dp.name), "..") 
!= 0)) {
                        char subdir[strlen(directory) + strlen(dp.name) + 2];
                        strcpy(subdir, directory);
                        strcat(subdir, "/");
                        strcat(subdir, dp.name);
 
-//                     struct stat s;
-//                     stat(dp->d_name, &s);
                        if (dp.filetype == APR_DIR) {
-//                     if (S_ISDIR(s.st_mode)) {
-//                     if (dp->d_type == DT_DIR) {
-                               bundleCache_deleteTree(subdir, mp);
+                               bundleArchive_deleteTree(subdir, mp);
                        } else {
                                remove(subdir);
                        }

Modified: incubator/celix/trunk/framework/private/src/bundle_cache.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_cache.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_cache.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_cache.c Mon May 16 
13:53:20 2011
@@ -66,21 +66,13 @@ void bundleCache_deleteTree(char * direc
        apr_dir_open(&dir, directory, mp);
        apr_finfo_t dp;
        while (apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) {
-
-       //DIR * dir = opendir(directory);
-//     struct dirent * dp;
-//     while ((dp = readdir(dir))) {
                if ((strcmp((dp.name), ".") != 0) && (strcmp((dp.name), "..") 
!= 0)) {
                        char subdir[strlen(directory) + strlen(dp.name) + 2];
                        strcpy(subdir, directory);
                        strcat(subdir, "/");
                        strcat(subdir, dp.name);
 
-//                     struct stat s;
-//                     stat(dp->d_name, &s);
                        if (dp.filetype == APR_DIR) {
-//                     if (S_ISDIR(s.st_mode)) {
-//                     if (dp->d_type == DT_DIR) {
                                bundleCache_deleteTree(subdir, mp);
                        } else {
                                remove(subdir);
@@ -94,7 +86,6 @@ ARRAY_LIST bundleCache_getArchives(BUNDL
        apr_dir_t *dir;
        apr_status_t status = apr_dir_open(&dir, cache->cacheDir, cache->mp);
 
-       //DIR * dir = opendir(cache->cacheDir);
        if (status == APR_ENOENT) {
                apr_dir_make(cache->cacheDir, 
APR_UREAD|APR_UWRITE|APR_UEXECUTE, cache->mp);
                status = apr_dir_open(&dir, cache->cacheDir, cache->mp);
@@ -102,20 +93,13 @@ ARRAY_LIST bundleCache_getArchives(BUNDL
 
        ARRAY_LIST list = arrayList_create();
        apr_finfo_t dp;
-       //apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir);
        while ((apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir))) {
-       //struct dirent * dp;
-       //while ((dp = readdir(dir))) {
                char archiveRoot[strlen(cache->cacheDir) + strlen(dp.name) + 2];
                strcpy(archiveRoot, cache->cacheDir);
                strcat(archiveRoot, "/");
                strcat(archiveRoot, dp.name);
 
                if (dp.filetype == APR_DIR
-//             struct stat s;
-//             stat(archiveRoot, &s);
-//             if (S_ISDIR(s.st_mode)
-//             if (dp->d_type == DT_DIR
                                && (strcmp((dp.name), ".") != 0)
                                && (strcmp((dp.name), "..") != 0)
                                && (strncmp(dp.name, "bundle", 6) == 0)
@@ -131,9 +115,9 @@ ARRAY_LIST bundleCache_getArchives(BUNDL
        return list;
 }
 
-BUNDLE_ARCHIVE bundleCache_createArchive(BUNDLE_CACHE cache, long id, char * 
location) {
+BUNDLE_ARCHIVE bundleCache_createArchive(BUNDLE_CACHE cache, long id, char * 
location, apr_pool_t *bundlePool) {
        char archiveRoot[256];
        sprintf(archiveRoot, "%s/bundle%ld",  cache->cacheDir, id);
 
-       return bundleArchive_create(strdup(archiveRoot), id, location, 
cache->mp);
+       return bundleArchive_create(strdup(archiveRoot), id, location, 
bundlePool);
 }

Modified: incubator/celix/trunk/framework/private/src/bundle_context.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_context.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_context.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_context.c Mon May 16 
13:53:20 2011
@@ -42,7 +42,7 @@ BUNDLE_CONTEXT bundleContext_create(FRAM
        context->framework = framework;
        context->bundle = bundle;
 
-       apr_pool_create(&context->pool, framework->mp);
+       apr_pool_create(&context->pool, bundle->memoryPool);
 
        return context;
 }

Modified: incubator/celix/trunk/framework/private/src/bundle_revision.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_revision.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_revision.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_revision.c Mon May 16 
13:53:20 2011
@@ -21,10 +21,8 @@ BUNDLE_REVISION bundleRevision_create(ch
        mkdir(root, 0755);
 
        if (inputFile != NULL) {
-               printf("extract from temp file\n");
                int e = extractBundle(inputFile, root);
        } else {
-               printf("extract from initial file\n");
                int e = extractBundle(location, root);
        }
 
@@ -48,6 +46,5 @@ char * bundleRevision_getLocation(BUNDLE
 }
 
 char * bundleRevision_getRoot(BUNDLE_REVISION revision) {
-       printf("rev root: %s\n", revision->root);
        return revision->root;
 }

Modified: incubator/celix/trunk/framework/private/src/filter.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/filter.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/filter.c (original)
+++ incubator/celix/trunk/framework/private/src/filter.c Mon May 16 13:53:20 
2011
@@ -335,7 +335,7 @@ char * filter_parseValue(char * filterSt
                        case '\\': {
                                (*pos)++;
                                c = filterString[*pos];
-                               //no break
+                               // no break
                        }
                        default: {
                                char ch[2];

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Mon May 16 13:53:20 
2011
@@ -294,9 +294,11 @@ celix_status_t fw_installBundle2(FRAMEWO
                return CELIX_SUCCESS;
        }
 
+       apr_pool_t *bundlePool;
+       apr_pool_create(&bundlePool, framework->mp);
        if (archive == NULL) {
                id = framework_getNextBundleId(framework);
-               archive = bundleCache_createArchive(framework->cache, id, 
location); //fw_createArchive(id, location);
+               archive = bundleCache_createArchive(framework->cache, id, 
location, bundlePool); //fw_createArchive(id, location);
        } else {
                // purge revision
                // multiple revisions not yet implemented
@@ -305,13 +307,12 @@ celix_status_t fw_installBundle2(FRAMEWO
        bool locked = framework_acquireGlobalLock(framework);
        if (!locked) {
                printf("Unable to acquire the global lock to install the 
bundle\n");
+               apr_pool_destroy(bundlePool);
                framework_releaseInstallLock(framework, location);
                return CELIX_BUNDLE_EXCEPTION;
        }
 
-       apr_pool_t *bundlePool;
-       apr_pool_create(&bundlePool, framework->mp);
-       celix_status_t rv = bundle_createFromArchive(bundle, framework, 
archive);
+       celix_status_t rv = bundle_createFromArchive(bundle, framework, 
archive, bundlePool);
        framework_releaseGlobalLock(framework);
 
        hashMap_put(framework->installedBundleMap, location, *bundle);
@@ -328,10 +329,8 @@ celix_status_t framework_getBundleEntry(
        }
 
        char *root = bundleRevision_getRoot(revision);
-       printf("Root and Entry name: %s - %s\n", root, name);
        char *e = NULL;
        apr_filepath_merge(&e, root, name, APR_FILEPATH_NOTABOVEROOT, 
framework->mp);
-       printf("Entry name: %s\n", e);
        apr_finfo_t info;
        apr_status_t ret = apr_stat(&info, e, APR_FINFO_DIRENT|APR_FINFO_TYPE, 
framework->mp);
        if (ret == APR_ENOENT) {
@@ -946,6 +945,7 @@ celix_status_t framework_waitForStop(FRA
                celix_log("Error unlocking the framework.");
                return CELIX_FRAMEWORK_EXCEPTION;
        }
+       return CELIX_SUCCESS;
 }
 
 static void * framework_shutdown(void * framework) {

Modified: incubator/celix/trunk/hello_world/activator.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/hello_world/activator.c?rev=1103737&r1=1103736&r2=1103737&view=diff
==============================================================================
--- incubator/celix/trunk/hello_world/activator.c (original)
+++ incubator/celix/trunk/hello_world/activator.c Mon May 16 13:53:20 2011
@@ -42,12 +42,6 @@ celix_status_t bundleActivator_create(BU
 celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
        struct userData * data = (struct userData *) userData;
        printf("Hello %s\n", data->word);
-
-       BUNDLE b = bundleContext_getBundle(context);
-       char *entry = NULL;
-       bundle_getEntry(b, "test.txt", &entry);
-       printf("Entry: %s", entry);
-
        return CELIX_SUCCESS;
 }
 


Reply via email to