Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
2,681 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
find_package(Jansson REQUIRED) | ||
|
||
add_celix_bundle(celix_pubsub_serializer_avrobin | ||
BUNDLE_SYMBOLICNAME "apache_celix_pubsub_serializer_avrobin" | ||
VERSION "1.0.0" | ||
GROUP "Celix/PubSub" | ||
SOURCES | ||
src/ps_avrobin_serializer_activator.c | ||
src/pubsub_avrobin_serializer_impl.c | ||
) | ||
target_include_directories(celix_pubsub_serializer_avrobin PRIVATE | ||
src | ||
${JANSSON_INCLUDE_DIR} | ||
) | ||
set_target_properties(celix_pubsub_serializer_avrobin PROPERTIES INSTALL_RPATH "$ORIGIN") | ||
target_link_libraries(celix_pubsub_serializer_avrobin PRIVATE Celix::pubsub_spi Celix::framework Celix::dfi ${JANSSON_LIBRARIES} Celix::log_helper) | ||
|
||
install_celix_bundle(celix_pubsub_serializer_avrobin EXPORT celix COMPONENT pubsub) | ||
|
||
add_library(Celix::pubsub_serializer_avrobin ALIAS celix_pubsub_serializer_avrobin) |
58 changes: 58 additions & 0 deletions
58
bundles/pubsub/pubsub_serializer_avrobin/src/ps_avrobin_serializer_activator.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
*Licensed to the Apache Software Foundation (ASF) under one | ||
*or more contributor license agreements. See the NOTICE file | ||
*distributed with this work for additional information | ||
*regarding copyright ownership. The ASF licenses this file | ||
*to you under the Apache License, Version 2.0 (the | ||
*"License"); you may not use this file except in compliance | ||
*with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
*Unless required by applicable law or agreed to in writing, | ||
*software distributed under the License is distributed on an | ||
*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
*specific language governing permissions and limitations | ||
*under the License. | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include <pubsub_constants.h> | ||
|
||
#include "celix_api.h" | ||
#include "pubsub_avrobin_serializer_impl.h" | ||
|
||
typedef struct psav_activator { | ||
pubsub_avrobin_serializer_t *serializer; | ||
pubsub_serializer_service_t serializerSvc; | ||
long serializerSvcId; | ||
} psav_activator_t; | ||
|
||
static int psav_start(psav_activator_t *act, celix_bundle_context_t *ctx) { | ||
act->serializerSvcId = -1L; | ||
|
||
celix_status_t status = pubsubAvrobinSerializer_create(ctx, &(act->serializer)); | ||
if (status == CELIX_SUCCESS) { | ||
act->serializerSvc.handle = act->serializer; | ||
|
||
act->serializerSvc.createSerializerMap = pubsubAvrobinSerializer_createSerializerMap; | ||
act->serializerSvc.destroySerializerMap = pubsubAvrobinSerializer_destroySerializerMap; | ||
|
||
/* Set serializer type */ | ||
celix_properties_t *props = celix_properties_create(); | ||
celix_properties_set(props, PUBSUB_SERIALIZER_TYPE_KEY, PUBSUB_AVROBIN_SERIALIZER_TYPE); | ||
|
||
act->serializerSvcId = celix_bundleContext_registerService(ctx, &act->serializerSvc, PUBSUB_SERIALIZER_SERVICE_NAME, props); | ||
} | ||
return status; | ||
} | ||
|
||
static int psav_stop(psav_activator_t *act, celix_bundle_context_t *ctx) { | ||
celix_bundleContext_unregisterService(ctx, act->serializerSvcId); | ||
act->serializerSvcId = -1L; | ||
pubsubAvrobinSerializer_destroy(act->serializer); | ||
return CELIX_SUCCESS; | ||
} | ||
|
||
CELIX_GEN_BUNDLE_ACTIVATOR(psav_activator_t, psav_start, psav_stop) |
Oops, something went wrong.