Example #1
0
celix_status_t deploymentAdmin_updateDeploymentPackageBundles(deployment_admin_pt admin, deployment_package_pt source) {
	celix_status_t status = CELIX_SUCCESS;

	array_list_pt infos = NULL;
	deploymentPackage_getBundleInfos(source, &infos);
	int i;
	for (i = 0; i < arrayList_size(infos); i++) {
		bundle_pt bundle = NULL;
		bundle_info_pt info = arrayList_get(infos, i);

		bundleContext_getBundle(admin->context, &bundle);
		char *entry = NULL;
		bundle_getEntry(bundle, "/", &entry);
		char *name = NULL;
		deploymentPackage_getName(source, &name);
		char *bundlePath = apr_pstrcat(admin->pool, entry, "repo/", name, "/", info->path, NULL);
		char *bsn = apr_pstrcat(admin->pool, "osgi-dp:", info->symbolicName, NULL);

		bundle_pt updateBundle = NULL;
		deploymentPackage_getBundle(source, info->symbolicName, &updateBundle);
		if (updateBundle != NULL) {
			//printf("Update bundle from: %s\n", bundlePath);
			bundle_update(updateBundle, bundlePath);
		} else {
			//printf("Install bundle from: %s\n", bundlePath);
			bundleContext_installBundle2(admin->context, bsn, bundlePath, &updateBundle);
		}
	}

	return status;
}
Example #2
0
celix_status_t driverLoader_loadDriverForLocator(driver_loader_pt loader, driver_locator_service_pt locator, char *driverId, array_list_pt *references) {
	celix_status_t status = CELIX_SUCCESS;
	//The list is created in the bundle_getRegisteredServices chain
	//arrayList_create(references);

	char *filename = NULL;
	status = locator->loadDriver(locator->locator, driverId, &filename);
	if (status == CELIX_SUCCESS) {
		bundle_pt bundle = NULL;
		int length = strlen(DRIVER_LOCATION_PREFIX) + strlen(driverId);
		char location[length];
		snprintf(location, length, "%s%s", DRIVER_LOCATION_PREFIX, driverId);
		status = bundleContext_installBundle2(loader->context, location, filename, &bundle);
		if (status == CELIX_SUCCESS) {
			status = bundle_start(bundle);
			if (status == CELIX_SUCCESS) {
				status = bundle_getRegisteredServices(bundle, references);
				if (status == CELIX_SUCCESS) {
					arrayList_addAll(loader->loadedDrivers, *references);
				}
			}
		}
	}

	return status;
}
Example #3
0
celix_status_t bundleContext_installBundle(bundle_context_pt context, char * location, bundle_pt *bundle) {
	return bundleContext_installBundle2(context, location, NULL, bundle);
}