Exemple #1
0
void uninstallCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
	char delims[] = " ";
	char * sub = NULL;
	char *save_ptr = NULL;
	char outString[256];

	sub = strtok_r(line, delims, &save_ptr);
	sub = strtok_r(NULL, delims, &save_ptr);

	if (sub == NULL) {
		err("Incorrect number of arguments.\n");
		sprintf(outString, "%s\n", command->usage);
		out(outString);
	} else {
		while (sub != NULL) {
			long id = atol(sub);
			bundle_pt bundle = NULL;
			bundleContext_getBundleById(command->bundleContext, id, &bundle);
			if (bundle != NULL) {
				bundle_uninstall(bundle);
			} else {
				err("Bundle id is invalid.");
			}
			sub = strtok_r(NULL, delims, &save_ptr);
		}
	}
}
Exemple #2
0
celix_status_t driverLoader_unloadDrivers(driver_loader_pt loader, driver_attributes_pt finalDriver) {
	celix_status_t status = CELIX_SUCCESS;

	service_reference_pt finalReference = NULL;
	if (finalDriver != NULL) {
		status = driverAttributes_getReference(finalDriver, &finalReference);
	}
	if (status == CELIX_SUCCESS) {
		int i;
		for (i = 0; i < arrayList_size(loader->loadedDrivers); i++) {
			service_reference_pt reference = arrayList_get(loader->loadedDrivers, i);
			bool equal = false;
			status = serviceReference_equals(reference, finalReference, &equal);
			if (status == CELIX_SUCCESS && !equal) {
				bundle_pt bundle = NULL;
				status = serviceReference_getBundle(reference, &bundle);
				if (status == CELIX_SUCCESS) {
					bundle_uninstall(bundle); // Ignore status
				}
			}
		}
	}

	return status;
}
celix_status_t importRegistrationFactory_close(import_registration_factory_pt registration_factory)
{
	celix_status_t status = CELIX_SUCCESS;

	if (registration_factory->bundle != NULL) {
		bundle_stop(registration_factory->bundle);
		bundle_uninstall(registration_factory->bundle);
	}

	return status;
}
Exemple #4
0
celix_status_t driverAttributes_tryUninstall(driver_attributes_pt driverAttributes) {
	celix_status_t status = CELIX_SUCCESS;

	bool inUse = false;

	status = driverAttributes_isInUse(driverAttributes, &inUse);
	if (status == CELIX_SUCCESS) {
		if (!inUse && driverAttributes->dynamic) {
			status = bundle_uninstall(driverAttributes->bundle);
		}
	}

	return status;
}
celix_status_t importRegistrationFactory_close(import_registration_factory_pt registration_factory)
{
	celix_status_t status = CELIX_SUCCESS;


	if (registration_factory->proxyFactoryTracker != NULL) {
		serviceTracker_close(registration_factory->proxyFactoryTracker);
	}

	if (registration_factory->bundle != NULL) {
		bundle_uninstall(registration_factory->bundle);
	}

	return status;
}
Exemple #6
0
celix_status_t deploymentAdmin_dropDeploymentPackageBundles(deployment_admin_pt admin, deployment_package_pt source, deployment_package_pt target) {
	celix_status_t status = CELIX_SUCCESS;

	if (target != NULL) {
		array_list_pt targetInfos = NULL;
		deploymentPackage_getBundleInfos(target, &targetInfos);
		int i;
		for (i = 0; i < arrayList_size(targetInfos); i++) {
			bundle_info_pt targetInfo = arrayList_get(targetInfos, i);
			if (!targetInfo->customizer) {
				bundle_info_pt info = NULL;
				deploymentPackage_getBundleInfoByName(source, targetInfo->symbolicName, &info);
				if (info == NULL) {
					bundle_pt bundle = NULL;
					deploymentPackage_getBundle(target, targetInfo->symbolicName, &bundle);
					bundle_uninstall(bundle);
				}
			}
		}
	}

	return status;
}