Esempio n. 1
0
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
    celix_status_t status = CELIX_SUCCESS;
    struct activator *activator = NULL;
    void *scope;

    activator = calloc(1, sizeof(struct activator));

    if (!activator) {
        return CELIX_ENOMEM;
    }

    activator->context = context;
    activator->endpointListenerService = NULL;
    activator->endpointListenerTracker = NULL;
    activator->hook = NULL;
    activator->manager = NULL;
    activator->remoteServiceAdminTracker = NULL;
    activator->serviceListener = NULL;
    activator->scopeService = calloc(1, sizeof(*(activator->scopeService)));
    if (activator->scopeService == NULL)
    {
    	free(activator);
    	return CELIX_ENOMEM;
    }

    activator->scopeService->addExportScope = tm_addExportScope;
    activator->scopeService->removeExportScope = tm_removeExportScope;
    activator->scopeService->addImportScope = tm_addImportScope;
    activator->scopeService->removeImportScope = tm_removeImportScope;
    activator->scopeReg = NULL; // explicitly needed, otherwise exception

    logHelper_create(context, &activator->loghelper);
    logHelper_start(activator->loghelper);

    status = topologyManager_create(context, activator->loghelper, &activator->manager, &scope);
    activator->scopeService->handle = scope;

    if (status == CELIX_SUCCESS) {
        status = bundleActivator_createEPLTracker(activator, &activator->endpointListenerTracker);
        if (status == CELIX_SUCCESS) {
            status = bundleActivator_createRSATracker(activator, &activator->remoteServiceAdminTracker);
            if (status == CELIX_SUCCESS) {
                status = bundleActivator_createServiceListener(activator, &activator->serviceListener);
                if (status == CELIX_SUCCESS) {
                	*userData = activator;
                }
            }
        }
    }

    return status;
}
Esempio n. 2
0
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
	celix_status_t status = CELIX_SUCCESS;

	struct activator* activator = malloc(sizeof(struct activator));
	if (!activator) {
		return CELIX_ENOMEM;
	}

	status = discovery_create(context, &activator->discovery);
	if (status != CELIX_SUCCESS) {
		return status;
	}

	activator->context = context;
	activator->endpointListenerTracker = NULL;
	activator->endpointListenerService = NULL;

	status = bundleActivator_createEPLTracker(activator, &activator->endpointListenerTracker);

	*userData = activator;

	return status;
}