コード例 #1
0
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
	celix_status_t status = CELIX_SUCCESS;
	struct activator *activator = userData;
	remote_endpoint_pt endpoint = NULL;
	remote_endpoint_service_pt endpointService = NULL;

	calculatorEndpoint_create(activator->pool, &endpoint);
	endpointService = apr_palloc(activator->pool, sizeof(*endpointService));
	endpointService->endpoint = endpoint;
	endpointService->handleRequest = calculatorEndpoint_handleRequest;
	endpointService->setService = calculatorEndpoint_setService;

	bundleContext_registerService(context, OSGI_RSA_REMOTE_ENDPOINT, endpointService, NULL, &activator->endpoint);


	return status;
}
コード例 #2
0
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
	celix_status_t status = CELIX_SUCCESS;
	struct activator *activator = userData;
	remote_endpoint_pt endpoint = NULL;
	remote_endpoint_service_pt endpointService = NULL;

	calculatorEndpoint_create(&endpoint);
	endpointService = calloc(1, sizeof(*endpointService));
	endpointService->endpoint = endpoint;
	endpointService->handleRequest = calculatorEndpoint_handleRequest;
        endpointService->setService = calculatorEndpoint_setService;

        properties_pt props = properties_create();
        properties_set(props, (char *) "remote.interface", (char *) CALCULATOR2_SERVICE);

        bundleContext_registerService(context, OSGI_RSA_REMOTE_ENDPOINT, endpointService, props, &activator->endpointServiceRegistration);

	activator->endpointService = endpointService;

	return status;
}