celix_status_t importRegistrationFactory_install(log_helper_pt helper, char* serviceName, bundle_context_pt context, import_registration_factory_pt *registration_factory)
{
	celix_status_t status;

	if ( (status = importRegistrationFactory_create(helper, serviceName, context, registration_factory)) == CELIX_SUCCESS) {
		// starting the proxy tracker first allows us to pick up already available proxy factories
		importRegistration_createProxyFactoryTracker(*registration_factory, &((*registration_factory)->proxyFactoryTracker));
		logHelper_log((*registration_factory)->loghelper, OSGI_LOGSERVICE_INFO, "remoteServiceAdmin_importService: new registration_factory added for %s at %p", serviceName, (*registration_factory)->proxyFactoryTracker);

		// check whether factory is available
		if (((*registration_factory)->trackedFactory == NULL) && ((status = importRegistrationFactory_open(*registration_factory)) != CELIX_SUCCESS)) {
			logHelper_log((*registration_factory)->loghelper, OSGI_LOGSERVICE_ERROR, "remoteServiceAdmin_importService: cannot open registration_factory for %s.", serviceName);

			importRegistrationFactory_close(*registration_factory);
			importRegistrationFactory_destroy(registration_factory);
		}
	}

	return status;
}
celix_status_t importRegistrationFactory_install(apr_pool_t *pool, char* serviceName, bundle_context_pt context, import_registration_factory_pt *registration_factory)
{
	celix_status_t status = CELIX_SUCCESS;

	if ( (status = importRegistrationFactory_create(pool, serviceName, context, registration_factory)) != CELIX_SUCCESS)
	{
		printf("remoteServiceAdmin_importService: error while creating importRegistrationFactory\n");
	}
	else if ((status = importRegistrationFactory_open(*registration_factory)) != CELIX_SUCCESS)
	{
		printf("remoteServiceAdmin_importService: cannot open registration_factory for %s \n  ", serviceName);
		importRegistrationFactory_destroy(registration_factory);
	}
	else
	{
		importRegistration_createProxyFactoryTracker(*registration_factory, &((*registration_factory)->proxyFactoryTracker));
		printf("remoteServiceAdmin_importService: new registration_factory added for %s at %p\n  ", serviceName, (*registration_factory)->proxyFactoryTracker);
	}

	return status;
}