You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2017/11/21 20:08:06 UTC
[09/19] celix git commit: CELIX-417: Refactor for CMake usage in RSA,
PSA and Docker. mostly trying to identify the api and common libraries
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/private/include/calculator_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/private/include/calculator_impl.h b/remote_services/examples/calculator_service/private/include/calculator_impl.h
deleted file mode 100644
index 5e075e4..0000000
--- a/remote_services/examples/calculator_service/private/include/calculator_impl.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- *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.
- */
-/*
- * calculator_impl.h
- *
- * \date Oct 5, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef CALCULATOR_IMPL_H_
-#define CALCULATOR_IMPL_H_
-
-#include "celix_errno.h"
-
-#include "calculator_service.h"
-
-struct calculator {
-};
-
-celix_status_t calculator_create(calculator_pt *calcuator);
-celix_status_t calculator_destroy(calculator_pt *calcuator);
-celix_status_t calculator_add(calculator_pt calcuator, double a, double b, double *result);
-celix_status_t calculator_sub(calculator_pt calcuator, double a, double b, double *result);
-celix_status_t calculator_sqrt(calculator_pt calcuator, double a, double *result);
-
-#endif /* CALCULATOR_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/private/src/calculator_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/private/src/calculator_activator.c b/remote_services/examples/calculator_service/private/src/calculator_activator.c
deleted file mode 100644
index 688a7b0..0000000
--- a/remote_services/examples/calculator_service/private/src/calculator_activator.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- *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.
- */
-/*
- * calculator_activator.c
- *
- * \date Oct 5, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_registration.h"
-
-#include "calculator_impl.h"
-#include "remote_constants.h"
-
-struct activator {
- calculator_pt calculator;
- calculator_service_pt service;
-
- service_registration_pt calculatorReg;
- service_registration_pt calculatorReg2;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator;
-
- activator = calloc(1, sizeof(*activator));
- if (!activator) {
- status = CELIX_ENOMEM;
- } else {
- activator->calculatorReg = NULL;
- activator->calculatorReg2 = NULL;
-
- *userData = activator;
- }
-
- return status;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator = userData;
- properties_pt properties = NULL;
-
- status = calculator_create(&activator->calculator);
- if (status == CELIX_SUCCESS) {
- activator->service = calloc(1, sizeof(*activator->service));
- if (!activator->service) {
- status = CELIX_ENOMEM;
- } else {
- activator->service->calculator = activator->calculator;
- activator->service->add = calculator_add;
- activator->service->sub = calculator_sub;
- activator->service->sqrt = calculator_sqrt;
-
- properties = properties_create();
- properties_set(properties, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, (char *) CALCULATOR_SERVICE);
-
- bundleContext_registerService(context, (char *) CALCULATOR_SERVICE, activator->service, properties, &activator->calculatorReg);
-
- properties_pt properties2 = properties_create();
- properties_set(properties2, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, (char *) CALCULATOR2_SERVICE);
- bundleContext_registerService(context, CALCULATOR2_SERVICE, activator->service, properties2, &activator->calculatorReg2);
- }
- }
-
- return status;
-}
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator *activator = userData;
-
- serviceRegistration_unregister(activator->calculatorReg);
- serviceRegistration_unregister(activator->calculatorReg2);
-
- free(activator->service);
-
- calculator_destroy(&activator->calculator);
-
- return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
-
- free(userData);
-
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/private/src/calculator_impl.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/private/src/calculator_impl.c b/remote_services/examples/calculator_service/private/src/calculator_impl.c
deleted file mode 100644
index adccb52..0000000
--- a/remote_services/examples/calculator_service/private/src/calculator_impl.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- *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.
- */
-/*
- * calculator_impl.c
- *
- * \date Oct 5, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <math.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "calculator_impl.h"
-
-celix_status_t calculator_create(calculator_pt *calculator) {
- celix_status_t status = CELIX_SUCCESS;
-
- *calculator = calloc(1, sizeof(**calculator));
- if (!*calculator) {
- status = CELIX_ENOMEM;
- }
-
- return status;
-}
-
-celix_status_t calculator_destroy(calculator_pt *calculator) {
- free(*calculator);
- return CELIX_SUCCESS;
-}
-
-celix_status_t calculator_add(calculator_pt calculator, double a, double b, double *result) {
- celix_status_t status = CELIX_SUCCESS;
-
- *result = a + b;
- printf("CALCULATOR: Add: %f + %f = %f\n", a, b, *result);
-
- return status;
-}
-
-celix_status_t calculator_sub(calculator_pt calculator, double a, double b, double *result) {
- celix_status_t status = CELIX_SUCCESS;
-
- *result = a - b;
- printf("CALCULATOR: Sub: %f + %f = %f\n", a, b, *result);
-
- return status;
-}
-
-celix_status_t calculator_sqrt(calculator_pt calculator, double a, double *result) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (a > 0) {
- *result = sqrt(a);
- printf("CALCULATOR: Sqrt: %f = %f\n", a, *result);
- } else {
- printf("CALCULATOR: Sqrt: %f = ERR\n", a);
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/public/include/calculator_service.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/public/include/calculator_service.h b/remote_services/examples/calculator_service/public/include/calculator_service.h
deleted file mode 100644
index 8e2f0dc..0000000
--- a/remote_services/examples/calculator_service/public/include/calculator_service.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- *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.
- */
-/*
- * calculator_service.h
- *
- * \date Oct 5, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef CALCULATOR_SERVICE_H_
-#define CALCULATOR_SERVICE_H_
-
-#define CALCULATOR_SERVICE "org.apache.celix.calc.api.Calculator"
-#define CALCULATOR2_SERVICE "org.apache.celix.calc.api.Calculator2"
-
-
-typedef struct calculator *calculator_pt;
-
-typedef struct calculator_service *calculator_service_pt;
-
-/*
- * The calculator service definition corresponds to the following Java interface:
- *
- * interface Calculator {
- * double add(double a, double b);
- * double sub(double a, double b);
- * double sqrt(double a);
- * }
- */
-struct calculator_service {
- calculator_pt calculator;
- int (*add)(calculator_pt calculator, double a, double b, double *result);
- int (*sub)(calculator_pt calculator, double a, double b, double *result);
- int (*sqrt)(calculator_pt calculator, double a, double *result);
-};
-
-
-
-#endif /* CALCULATOR_SERVICE_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/public/include/org.apache.celix.calc.api.Calculator2.descriptor
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/public/include/org.apache.celix.calc.api.Calculator2.descriptor b/remote_services/examples/calculator_service/public/include/org.apache.celix.calc.api.Calculator2.descriptor
deleted file mode 100644
index b784838..0000000
--- a/remote_services/examples/calculator_service/public/include/org.apache.celix.calc.api.Calculator2.descriptor
+++ /dev/null
@@ -1,11 +0,0 @@
-:header
-type=interface
-name=calculator
-version=1.3.0
-:annotations
-classname=org.example.Calculator
-:types
-:methods
-add(DD)D=add(#am=handle;PDD#am=pre;*D)N
-sub(DD)D=sub(#am=handle;PDD#am=pre;*D)N
-sqrt(D)D=sqrt(#am=handle;PD#am=pre;*D)N
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/src/calculator_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/src/calculator_activator.c b/remote_services/examples/calculator_service/src/calculator_activator.c
new file mode 100644
index 0000000..688a7b0
--- /dev/null
+++ b/remote_services/examples/calculator_service/src/calculator_activator.c
@@ -0,0 +1,110 @@
+/**
+ *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.
+ */
+/*
+ * calculator_activator.c
+ *
+ * \date Oct 5, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "service_registration.h"
+
+#include "calculator_impl.h"
+#include "remote_constants.h"
+
+struct activator {
+ calculator_pt calculator;
+ calculator_service_pt service;
+
+ service_registration_pt calculatorReg;
+ service_registration_pt calculatorReg2;
+};
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator;
+
+ activator = calloc(1, sizeof(*activator));
+ if (!activator) {
+ status = CELIX_ENOMEM;
+ } else {
+ activator->calculatorReg = NULL;
+ activator->calculatorReg2 = NULL;
+
+ *userData = activator;
+ }
+
+ return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator = userData;
+ properties_pt properties = NULL;
+
+ status = calculator_create(&activator->calculator);
+ if (status == CELIX_SUCCESS) {
+ activator->service = calloc(1, sizeof(*activator->service));
+ if (!activator->service) {
+ status = CELIX_ENOMEM;
+ } else {
+ activator->service->calculator = activator->calculator;
+ activator->service->add = calculator_add;
+ activator->service->sub = calculator_sub;
+ activator->service->sqrt = calculator_sqrt;
+
+ properties = properties_create();
+ properties_set(properties, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, (char *) CALCULATOR_SERVICE);
+
+ bundleContext_registerService(context, (char *) CALCULATOR_SERVICE, activator->service, properties, &activator->calculatorReg);
+
+ properties_pt properties2 = properties_create();
+ properties_set(properties2, (char *) OSGI_RSA_SERVICE_EXPORTED_INTERFACES, (char *) CALCULATOR2_SERVICE);
+ bundleContext_registerService(context, CALCULATOR2_SERVICE, activator->service, properties2, &activator->calculatorReg2);
+ }
+ }
+
+ return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator *activator = userData;
+
+ serviceRegistration_unregister(activator->calculatorReg);
+ serviceRegistration_unregister(activator->calculatorReg2);
+
+ free(activator->service);
+
+ calculator_destroy(&activator->calculator);
+
+ return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ free(userData);
+
+ return status;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/src/calculator_impl.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/src/calculator_impl.c b/remote_services/examples/calculator_service/src/calculator_impl.c
new file mode 100644
index 0000000..adccb52
--- /dev/null
+++ b/remote_services/examples/calculator_service/src/calculator_impl.c
@@ -0,0 +1,79 @@
+/**
+ *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.
+ */
+/*
+ * calculator_impl.c
+ *
+ * \date Oct 5, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <math.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "calculator_impl.h"
+
+celix_status_t calculator_create(calculator_pt *calculator) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ *calculator = calloc(1, sizeof(**calculator));
+ if (!*calculator) {
+ status = CELIX_ENOMEM;
+ }
+
+ return status;
+}
+
+celix_status_t calculator_destroy(calculator_pt *calculator) {
+ free(*calculator);
+ return CELIX_SUCCESS;
+}
+
+celix_status_t calculator_add(calculator_pt calculator, double a, double b, double *result) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ *result = a + b;
+ printf("CALCULATOR: Add: %f + %f = %f\n", a, b, *result);
+
+ return status;
+}
+
+celix_status_t calculator_sub(calculator_pt calculator, double a, double b, double *result) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ *result = a - b;
+ printf("CALCULATOR: Sub: %f + %f = %f\n", a, b, *result);
+
+ return status;
+}
+
+celix_status_t calculator_sqrt(calculator_pt calculator, double a, double *result) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ if (a > 0) {
+ *result = sqrt(a);
+ printf("CALCULATOR: Sqrt: %f = %f\n", a, *result);
+ } else {
+ printf("CALCULATOR: Sqrt: %f = ERR\n", a);
+ status = CELIX_ILLEGAL_ARGUMENT;
+ }
+
+ return status;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_service/src/calculator_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_service/src/calculator_impl.h b/remote_services/examples/calculator_service/src/calculator_impl.h
new file mode 100644
index 0000000..5e075e4
--- /dev/null
+++ b/remote_services/examples/calculator_service/src/calculator_impl.h
@@ -0,0 +1,43 @@
+/**
+ *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.
+ */
+/*
+ * calculator_impl.h
+ *
+ * \date Oct 5, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef CALCULATOR_IMPL_H_
+#define CALCULATOR_IMPL_H_
+
+#include "celix_errno.h"
+
+#include "calculator_service.h"
+
+struct calculator {
+};
+
+celix_status_t calculator_create(calculator_pt *calcuator);
+celix_status_t calculator_destroy(calculator_pt *calcuator);
+celix_status_t calculator_add(calculator_pt calcuator, double a, double b, double *result);
+celix_status_t calculator_sub(calculator_pt calcuator, double a, double b, double *result);
+celix_status_t calculator_sqrt(calculator_pt calcuator, double a, double *result);
+
+#endif /* CALCULATOR_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/CMakeLists.txt b/remote_services/examples/calculator_shell/CMakeLists.txt
index 980fa1a..78c0737 100644
--- a/remote_services/examples/calculator_shell/CMakeLists.txt
+++ b/remote_services/examples/calculator_shell/CMakeLists.txt
@@ -15,28 +15,22 @@
# specific language governing permissions and limitations
# under the License.
-include_directories("private/include")
-include_directories("../../../utils/public/include")
-include_directories("../calculator_service/public/include")
-
-add_bundle(calculator_shell SOURCES
- private/src/add_command
- private/src/sub_command
- private/src/sqrt_command
- private/src/calculator_shell_activator
-
- private/include/add_command.h
- private/include/sqrt_command.h
- private/include/sub_command.h
-
+add_bundle(calculator_shell
+ SOURCES
+ src/add_command
+ src/sub_command
+ src/sqrt_command
+ src/calculator_shell_activator
VERSION 0.0.1
SYMBOLIC_NAME "apache_celix_remoting_calculator_shell"
)
+target_include_directories(calculator_shell PRIVATE src)
+target_link_libraries(calculator_shell PRIVATE Celix::shell_api calculator_api)
bundle_files(calculator_shell
- ../calculator_service/public/include/org.apache.celix.calc.api.Calculator2.descriptor
- #private/include/org.apache.celix.calc.api.Calculator2.descriptor ##Use this descriptor in case you want to try out versioning!
+ ../calculator_api/include/org.apache.celix.calc.api.Calculator2.descriptor
+ #src/org.apache.celix.calc.api.Calculator2.descriptor ##Use this descriptor in case you want to try out versioning!
DESTINATION .
)
-target_link_libraries(calculator_shell PRIVATE Celix::shell_api)
+
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/include/add_command.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/include/add_command.h b/remote_services/examples/calculator_shell/private/include/add_command.h
deleted file mode 100644
index 58a7bda..0000000
--- a/remote_services/examples/calculator_shell/private/include/add_command.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *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.
- */
-/*
- * add_command.h
- *
- * \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef ADD_COMMAND_H_
-#define ADD_COMMAND_H_
-
-void addCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
-
-#endif /* ADD_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/include/org.apache.celix.calc.api.Calculator2.descriptor
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/include/org.apache.celix.calc.api.Calculator2.descriptor b/remote_services/examples/calculator_shell/private/include/org.apache.celix.calc.api.Calculator2.descriptor
deleted file mode 100644
index 789af9a..0000000
--- a/remote_services/examples/calculator_shell/private/include/org.apache.celix.calc.api.Calculator2.descriptor
+++ /dev/null
@@ -1,11 +0,0 @@
-+:header
-+type=interface
-+name=calculator
-+version=1.2.3
-+:annotations
-+classname=org.example.Calculator
-+:types
-+:methods
-+add(DD)D=add(#am=handle;PDD#am=pre;*D)N
-+sub(DD)D=sub(#am=handle;PDD#am=pre;*D)N
-+sqrt(D)D=sqrt(#am=handle;PD#am=pre;*D)N
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/include/sqrt_command.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/include/sqrt_command.h b/remote_services/examples/calculator_shell/private/include/sqrt_command.h
deleted file mode 100644
index c9d07d2..0000000
--- a/remote_services/examples/calculator_shell/private/include/sqrt_command.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *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.
- */
-/*
- * sqrt_command.h
- *
- * \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef SQRT_COMMAND_H_
-#define SQRT_COMMAND_H_
-
-void sqrtCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
-
-#endif /* SQRT_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/include/sub_command.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/include/sub_command.h b/remote_services/examples/calculator_shell/private/include/sub_command.h
deleted file mode 100644
index cf13616..0000000
--- a/remote_services/examples/calculator_shell/private/include/sub_command.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- *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.
- */
-/*
- * sub_command.h
- *
- * \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef SUB_COMMAND_H_
-#define SUB_COMMAND_H_
-
-void subCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
-
-#endif /* SUB_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/src/add_command.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/src/add_command.c b/remote_services/examples/calculator_shell/private/src/add_command.c
deleted file mode 100644
index b2520ae..0000000
--- a/remote_services/examples/calculator_shell/private/src/add_command.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- *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.
- */
-/*
- * add_command.c
- *
- * \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <command.h>
-
-#include "array_list.h"
-#include "bundle_context.h"
-#include "add_command.h"
-#include "calculator_service.h"
-
-
-static celix_status_t addCommand_isNumeric(char *number, bool *ret);
-
-void addCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
- celix_status_t status = CELIX_SUCCESS;
- service_reference_pt calculatorService = NULL;
-
- status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
- if (calculatorService == NULL) {
- fprintf(err, "ADD: Cannot get reference for %s. Trying to get one for %s\n", CALCULATOR_SERVICE, CALCULATOR2_SERVICE);
- status = bundleContext_getServiceReference(context, (char *) CALCULATOR2_SERVICE, &calculatorService);
- if (calculatorService == NULL) {
- fprintf(err, "ADD: Cannot get reference even for %s.\n", CALCULATOR2_SERVICE);
- }
- }
- if (status == CELIX_SUCCESS) {
- char *token = line;
- strtok_r(line, " ", &token);
- char *aStr = strtok_r(NULL, " ", &token);
- char *bStr = strtok_r(NULL, " ", &token);
- bool aNumeric, bNumeric;
- if (aStr != NULL && bStr != NULL) {
- addCommand_isNumeric(aStr, &aNumeric);
- addCommand_isNumeric(bStr, &bNumeric);
- if(aNumeric && bNumeric){
- calculator_service_pt calculator = NULL;
- status = bundleContext_getService(context, calculatorService, (void *) &calculator);
- if (status == CELIX_SUCCESS && calculator != NULL) {
- double a = atof(aStr);
- double b = atof(bStr);
- double result = 0;
- status = calculator->add(calculator->calculator, a, b, &result);
- if (status == CELIX_SUCCESS) {
- fprintf(out, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result);
- } else {
- fprintf(err, "ADD: Unexpected exception in Calc service\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
- } else {
- fprintf(err, "ADD: Requires 2 numerical parameter\n");
- }
- } else {
- fprintf(err, "ADD: Requires 2 numerical parameter\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
-
- //return status;
-}
-
-static celix_status_t addCommand_isNumeric(char *number, bool *ret) {
- celix_status_t status = CELIX_SUCCESS;
- *ret = true;
- while(*number) {
- if(!isdigit(*number) && *number != '.') {
- *ret = false;
- break;
- }
- number++;
- }
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c b/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
deleted file mode 100644
index d6b561b..0000000
--- a/remote_services/examples/calculator_shell/private/src/calculator_shell_activator.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- *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.
- */
-/*
- * calculator_shell_activator.c
- *
- * \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <string.h>
-#include <command.h>
-
-#include "bundle_activator.h"
-#include "bundle_context.h"
-#include "service_registration.h"
-
-#include "add_command.h"
-#include "sub_command.h"
-#include "sqrt_command.h"
-
-struct activator {
- service_registration_pt addCommand;
- command_service_pt addCmd;
- command_service_pt addCmdSrv;
-
- service_registration_pt subCommand;
- command_service_pt subCmd;
- command_service_pt subCmdSrv;
-
- service_registration_pt sqrtCommand;
- command_service_pt sqrtCmd;
- command_service_pt sqrtCmdSrv;
-};
-
-celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- celix_status_t status = CELIX_SUCCESS;
- if (status == CELIX_SUCCESS) {
- *userData = calloc(1, sizeof(struct activator));
- if (!*userData) {
- status = CELIX_ENOMEM;
- } else {
- ((struct activator *) (*userData))->addCommand = NULL;
- ((struct activator *) (*userData))->subCommand = NULL;
- ((struct activator *) (*userData))->sqrtCommand = NULL;
-
- ((struct activator *) (*userData))->addCmd = NULL;
- ((struct activator *) (*userData))->subCmd = NULL;
- ((struct activator *) (*userData))->sqrtCmd = NULL;
-
- ((struct activator *) (*userData))->addCmdSrv = NULL;
- ((struct activator *) (*userData))->subCmdSrv = NULL;
- ((struct activator *) (*userData))->sqrtCmdSrv = NULL;
- }
- }
-
- return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
-
- struct activator * activator = (struct activator *) userData;
-
- activator->addCmdSrv = calloc(1, sizeof(*activator->addCmdSrv));
- activator->addCmdSrv->handle = context;
- activator->addCmdSrv->executeCommand = (void *)addCommand_execute;
- properties_pt props = properties_create();
- properties_set(props, OSGI_SHELL_COMMAND_NAME, "add");
- bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->addCmdSrv, props, &activator->addCommand);
-
-
- activator->sqrtCmdSrv = calloc(1, sizeof(*activator->sqrtCmdSrv));
- activator->sqrtCmdSrv->handle = context;
- activator->sqrtCmdSrv->executeCommand = (void *)sqrtCommand_execute;
- props = properties_create();
- properties_set(props, OSGI_SHELL_COMMAND_NAME, "sqrt");
- bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->sqrtCmdSrv, props, &activator->sqrtCommand);
-
- activator->subCmdSrv = calloc(1, sizeof(*activator->subCmdSrv));
- activator->subCmdSrv->handle = context;
- activator->subCmdSrv->executeCommand = (void *)subCommand_execute;
- props = properties_create();
- properties_set(props, OSGI_SHELL_COMMAND_NAME, "sub");
- bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->subCmdSrv, props, &activator->subCommand);
-
- return status;
-}
-
-
-celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
- celix_status_t status = CELIX_SUCCESS;
- struct activator * activator = (struct activator *) userData;
- serviceRegistration_unregister(activator->addCommand);
- serviceRegistration_unregister(activator->subCommand);
- serviceRegistration_unregister(activator->sqrtCommand);
-
- free(activator->addCmdSrv);
- free(activator->subCmdSrv);
- free(activator->sqrtCmdSrv);
-
- return status;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
- free(userData);
- return CELIX_SUCCESS;
-}
-
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/src/sqrt_command.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/src/sqrt_command.c b/remote_services/examples/calculator_shell/private/src/sqrt_command.c
deleted file mode 100644
index 2e7238c..0000000
--- a/remote_services/examples/calculator_shell/private/src/sqrt_command.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *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.
- */
-/*
- * sqrt_command.c
- *
- * \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "array_list.h"
-#include "bundle_context.h"
-#include "sqrt_command.h"
-#include "calculator_service.h"
-
-static celix_status_t sqrtCommand_isNumeric(char *number, bool *ret);
-
-void sqrtCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
- celix_status_t status = CELIX_SUCCESS;
- service_reference_pt calculatorService = NULL;
-
- status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
- if (calculatorService == NULL) {
- fprintf(err, "SQRT: Cannot get reference for %s. Trying to get one for %s\n", CALCULATOR_SERVICE, CALCULATOR2_SERVICE);
- status = bundleContext_getServiceReference(context, (char *) CALCULATOR2_SERVICE, &calculatorService);
- if (calculatorService == NULL) {
- fprintf(err, "SQRT: Cannot get reference even for %s.\n", CALCULATOR2_SERVICE);
- }
- }
- if (status == CELIX_SUCCESS) {
- char *token = line;
- strtok_r(line, " ", &token);
- char *aStr = strtok_r(NULL, " ", &token);
- if(aStr != NULL){
- bool numeric;
- sqrtCommand_isNumeric(aStr, &numeric);
- if (numeric) {
- calculator_service_pt calculator = NULL;
- status = bundleContext_getService(context, calculatorService, (void *) &calculator);
- if (status == CELIX_SUCCESS && calculator != NULL) {
- double a = atof(aStr);
- double result = 0;
- status = calculator->sqrt(calculator->calculator, a, &result);
- if (status == CELIX_SUCCESS) {
- fprintf(out, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result);
- } else {
- fprintf(err, "SQRT: Unexpected exception in Calc service\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
- } else {
- fprintf(err, "SQRT: Requires 1 numerical parameter\n");
- }
- } else {
- fprintf(err, "SQRT: Requires 1 numerical parameter\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
-
- //return status;
-}
-
-static celix_status_t sqrtCommand_isNumeric(char *number, bool *ret) {
- celix_status_t status = CELIX_SUCCESS;
- *ret = true;
- while(*number) {
- if(!isdigit(*number) && *number != '.') {
- *ret = false;
- break;
- }
- number++;
- }
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/private/src/sub_command.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/private/src/sub_command.c b/remote_services/examples/calculator_shell/private/src/sub_command.c
deleted file mode 100644
index 672ea4c..0000000
--- a/remote_services/examples/calculator_shell/private/src/sub_command.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- *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.
- */
-/*
- * sub_command.c
- *
- * \date Oct 13, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "array_list.h"
-#include "bundle_context.h"
-#include "sub_command.h"
-#include "calculator_service.h"
-
-static celix_status_t subCommand_isNumeric(char *number, bool *ret);
-
-void subCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
- celix_status_t status = CELIX_SUCCESS;
- service_reference_pt calculatorService = NULL;
-
- status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
- if (calculatorService == NULL) {
- fprintf(err, "SUB: Cannot get reference for %s. Trying to get one for %s\n", CALCULATOR_SERVICE, CALCULATOR2_SERVICE);
- status = bundleContext_getServiceReference(context, (char *) CALCULATOR2_SERVICE, &calculatorService);
- if (calculatorService == NULL) {
- fprintf(err, "SUB: Cannot get reference even for %s.\n", CALCULATOR2_SERVICE);
- }
- }
- if (status == CELIX_SUCCESS) {
- char *token = line;
- strtok_r(line, " ", &token);
- char *aStr = strtok_r(NULL, " ", &token);
- char *bStr = strtok_r(NULL, " ", &token);
- if(aStr != NULL && bStr != NULL ){
- bool aNumeric, bNumeric;
- subCommand_isNumeric(aStr, &aNumeric);
- subCommand_isNumeric(bStr, &bNumeric);
- if (aNumeric && bNumeric) {
- calculator_service_pt calculator = NULL;
- status = bundleContext_getService(context, calculatorService, (void *) &calculator);
- if (status == CELIX_SUCCESS && calculator != NULL) {
- double a = atof(aStr);
- double b = atof(bStr);
- double result = 0;
- status = calculator->sub(calculator->calculator, a, b, &result);
- if (status == CELIX_SUCCESS) {
- fprintf(out, "CALCULATOR_SHELL: Sub: %f - %f = %f\n", a, b, result);
- } else {
- fprintf(err, "SUB: Unexpected exception in Calc service\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
- } else {
- fprintf(err, "SUB: Requires 2 numerical parameter\n");
- }
- } else {
- fprintf(err, "SUB: Requires 2 numerical parameter\n");
- }
- } else {
- fprintf(err, "No calc service available\n");
- }
-
- //return status;
-}
-
-static celix_status_t subCommand_isNumeric(char *number, bool *ret) {
- celix_status_t status = CELIX_SUCCESS;
- *ret = true;
- while(*number) {
- if(!isdigit(*number) && *number != '.') {
- *ret = false;
- break;
- }
- number++;
- }
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/add_command.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/add_command.c b/remote_services/examples/calculator_shell/src/add_command.c
new file mode 100644
index 0000000..b2520ae
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/add_command.c
@@ -0,0 +1,101 @@
+/**
+ *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.
+ */
+/*
+ * add_command.c
+ *
+ * \date Oct 13, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <command.h>
+
+#include "array_list.h"
+#include "bundle_context.h"
+#include "add_command.h"
+#include "calculator_service.h"
+
+
+static celix_status_t addCommand_isNumeric(char *number, bool *ret);
+
+void addCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
+ celix_status_t status = CELIX_SUCCESS;
+ service_reference_pt calculatorService = NULL;
+
+ status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
+ if (calculatorService == NULL) {
+ fprintf(err, "ADD: Cannot get reference for %s. Trying to get one for %s\n", CALCULATOR_SERVICE, CALCULATOR2_SERVICE);
+ status = bundleContext_getServiceReference(context, (char *) CALCULATOR2_SERVICE, &calculatorService);
+ if (calculatorService == NULL) {
+ fprintf(err, "ADD: Cannot get reference even for %s.\n", CALCULATOR2_SERVICE);
+ }
+ }
+ if (status == CELIX_SUCCESS) {
+ char *token = line;
+ strtok_r(line, " ", &token);
+ char *aStr = strtok_r(NULL, " ", &token);
+ char *bStr = strtok_r(NULL, " ", &token);
+ bool aNumeric, bNumeric;
+ if (aStr != NULL && bStr != NULL) {
+ addCommand_isNumeric(aStr, &aNumeric);
+ addCommand_isNumeric(bStr, &bNumeric);
+ if(aNumeric && bNumeric){
+ calculator_service_pt calculator = NULL;
+ status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+ if (status == CELIX_SUCCESS && calculator != NULL) {
+ double a = atof(aStr);
+ double b = atof(bStr);
+ double result = 0;
+ status = calculator->add(calculator->calculator, a, b, &result);
+ if (status == CELIX_SUCCESS) {
+ fprintf(out, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result);
+ } else {
+ fprintf(err, "ADD: Unexpected exception in Calc service\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+ } else {
+ fprintf(err, "ADD: Requires 2 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "ADD: Requires 2 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+
+ //return status;
+}
+
+static celix_status_t addCommand_isNumeric(char *number, bool *ret) {
+ celix_status_t status = CELIX_SUCCESS;
+ *ret = true;
+ while(*number) {
+ if(!isdigit(*number) && *number != '.') {
+ *ret = false;
+ break;
+ }
+ number++;
+ }
+ return status;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/add_command.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/add_command.h b/remote_services/examples/calculator_shell/src/add_command.h
new file mode 100644
index 0000000..58a7bda
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/add_command.h
@@ -0,0 +1,32 @@
+/**
+ *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.
+ */
+/*
+ * add_command.h
+ *
+ * \date Oct 13, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef ADD_COMMAND_H_
+#define ADD_COMMAND_H_
+
+void addCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
+
+#endif /* ADD_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/calculator_shell_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/calculator_shell_activator.c b/remote_services/examples/calculator_shell/src/calculator_shell_activator.c
new file mode 100644
index 0000000..d6b561b
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/calculator_shell_activator.c
@@ -0,0 +1,125 @@
+/**
+ *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.
+ */
+/*
+ * calculator_shell_activator.c
+ *
+ * \date Oct 13, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+#include <stdlib.h>
+#include <string.h>
+#include <command.h>
+
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "service_registration.h"
+
+#include "add_command.h"
+#include "sub_command.h"
+#include "sqrt_command.h"
+
+struct activator {
+ service_registration_pt addCommand;
+ command_service_pt addCmd;
+ command_service_pt addCmdSrv;
+
+ service_registration_pt subCommand;
+ command_service_pt subCmd;
+ command_service_pt subCmdSrv;
+
+ service_registration_pt sqrtCommand;
+ command_service_pt sqrtCmd;
+ command_service_pt sqrtCmdSrv;
+};
+
+celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
+ celix_status_t status = CELIX_SUCCESS;
+ if (status == CELIX_SUCCESS) {
+ *userData = calloc(1, sizeof(struct activator));
+ if (!*userData) {
+ status = CELIX_ENOMEM;
+ } else {
+ ((struct activator *) (*userData))->addCommand = NULL;
+ ((struct activator *) (*userData))->subCommand = NULL;
+ ((struct activator *) (*userData))->sqrtCommand = NULL;
+
+ ((struct activator *) (*userData))->addCmd = NULL;
+ ((struct activator *) (*userData))->subCmd = NULL;
+ ((struct activator *) (*userData))->sqrtCmd = NULL;
+
+ ((struct activator *) (*userData))->addCmdSrv = NULL;
+ ((struct activator *) (*userData))->subCmdSrv = NULL;
+ ((struct activator *) (*userData))->sqrtCmdSrv = NULL;
+ }
+ }
+
+ return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ struct activator * activator = (struct activator *) userData;
+
+ activator->addCmdSrv = calloc(1, sizeof(*activator->addCmdSrv));
+ activator->addCmdSrv->handle = context;
+ activator->addCmdSrv->executeCommand = (void *)addCommand_execute;
+ properties_pt props = properties_create();
+ properties_set(props, OSGI_SHELL_COMMAND_NAME, "add");
+ bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->addCmdSrv, props, &activator->addCommand);
+
+
+ activator->sqrtCmdSrv = calloc(1, sizeof(*activator->sqrtCmdSrv));
+ activator->sqrtCmdSrv->handle = context;
+ activator->sqrtCmdSrv->executeCommand = (void *)sqrtCommand_execute;
+ props = properties_create();
+ properties_set(props, OSGI_SHELL_COMMAND_NAME, "sqrt");
+ bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->sqrtCmdSrv, props, &activator->sqrtCommand);
+
+ activator->subCmdSrv = calloc(1, sizeof(*activator->subCmdSrv));
+ activator->subCmdSrv->handle = context;
+ activator->subCmdSrv->executeCommand = (void *)subCommand_execute;
+ props = properties_create();
+ properties_set(props, OSGI_SHELL_COMMAND_NAME, "sub");
+ bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, activator->subCmdSrv, props, &activator->subCommand);
+
+ return status;
+}
+
+
+celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
+ celix_status_t status = CELIX_SUCCESS;
+ struct activator * activator = (struct activator *) userData;
+ serviceRegistration_unregister(activator->addCommand);
+ serviceRegistration_unregister(activator->subCommand);
+ serviceRegistration_unregister(activator->sqrtCommand);
+
+ free(activator->addCmdSrv);
+ free(activator->subCmdSrv);
+ free(activator->sqrtCmdSrv);
+
+ return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+ free(userData);
+ return CELIX_SUCCESS;
+}
+
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/org.apache.celix.calc.api.Calculator2.descriptor
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/org.apache.celix.calc.api.Calculator2.descriptor b/remote_services/examples/calculator_shell/src/org.apache.celix.calc.api.Calculator2.descriptor
new file mode 100644
index 0000000..789af9a
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/org.apache.celix.calc.api.Calculator2.descriptor
@@ -0,0 +1,11 @@
++:header
++type=interface
++name=calculator
++version=1.2.3
++:annotations
++classname=org.example.Calculator
++:types
++:methods
++add(DD)D=add(#am=handle;PDD#am=pre;*D)N
++sub(DD)D=sub(#am=handle;PDD#am=pre;*D)N
++sqrt(D)D=sqrt(#am=handle;PD#am=pre;*D)N
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/sqrt_command.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/sqrt_command.c b/remote_services/examples/calculator_shell/src/sqrt_command.c
new file mode 100644
index 0000000..2e7238c
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/sqrt_command.c
@@ -0,0 +1,96 @@
+/**
+ *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.
+ */
+/*
+ * sqrt_command.c
+ *
+ * \date Oct 13, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "array_list.h"
+#include "bundle_context.h"
+#include "sqrt_command.h"
+#include "calculator_service.h"
+
+static celix_status_t sqrtCommand_isNumeric(char *number, bool *ret);
+
+void sqrtCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
+ celix_status_t status = CELIX_SUCCESS;
+ service_reference_pt calculatorService = NULL;
+
+ status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
+ if (calculatorService == NULL) {
+ fprintf(err, "SQRT: Cannot get reference for %s. Trying to get one for %s\n", CALCULATOR_SERVICE, CALCULATOR2_SERVICE);
+ status = bundleContext_getServiceReference(context, (char *) CALCULATOR2_SERVICE, &calculatorService);
+ if (calculatorService == NULL) {
+ fprintf(err, "SQRT: Cannot get reference even for %s.\n", CALCULATOR2_SERVICE);
+ }
+ }
+ if (status == CELIX_SUCCESS) {
+ char *token = line;
+ strtok_r(line, " ", &token);
+ char *aStr = strtok_r(NULL, " ", &token);
+ if(aStr != NULL){
+ bool numeric;
+ sqrtCommand_isNumeric(aStr, &numeric);
+ if (numeric) {
+ calculator_service_pt calculator = NULL;
+ status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+ if (status == CELIX_SUCCESS && calculator != NULL) {
+ double a = atof(aStr);
+ double result = 0;
+ status = calculator->sqrt(calculator->calculator, a, &result);
+ if (status == CELIX_SUCCESS) {
+ fprintf(out, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result);
+ } else {
+ fprintf(err, "SQRT: Unexpected exception in Calc service\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+ } else {
+ fprintf(err, "SQRT: Requires 1 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "SQRT: Requires 1 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+
+ //return status;
+}
+
+static celix_status_t sqrtCommand_isNumeric(char *number, bool *ret) {
+ celix_status_t status = CELIX_SUCCESS;
+ *ret = true;
+ while(*number) {
+ if(!isdigit(*number) && *number != '.') {
+ *ret = false;
+ break;
+ }
+ number++;
+ }
+ return status;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/sqrt_command.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/sqrt_command.h b/remote_services/examples/calculator_shell/src/sqrt_command.h
new file mode 100644
index 0000000..c9d07d2
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/sqrt_command.h
@@ -0,0 +1,32 @@
+/**
+ *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.
+ */
+/*
+ * sqrt_command.h
+ *
+ * \date Oct 13, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef SQRT_COMMAND_H_
+#define SQRT_COMMAND_H_
+
+void sqrtCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
+
+#endif /* SQRT_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/sub_command.c
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/sub_command.c b/remote_services/examples/calculator_shell/src/sub_command.c
new file mode 100644
index 0000000..672ea4c
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/sub_command.c
@@ -0,0 +1,99 @@
+/**
+ *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.
+ */
+/*
+ * sub_command.c
+ *
+ * \date Oct 13, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "array_list.h"
+#include "bundle_context.h"
+#include "sub_command.h"
+#include "calculator_service.h"
+
+static celix_status_t subCommand_isNumeric(char *number, bool *ret);
+
+void subCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err) {
+ celix_status_t status = CELIX_SUCCESS;
+ service_reference_pt calculatorService = NULL;
+
+ status = bundleContext_getServiceReference(context, (char *) CALCULATOR_SERVICE, &calculatorService);
+ if (calculatorService == NULL) {
+ fprintf(err, "SUB: Cannot get reference for %s. Trying to get one for %s\n", CALCULATOR_SERVICE, CALCULATOR2_SERVICE);
+ status = bundleContext_getServiceReference(context, (char *) CALCULATOR2_SERVICE, &calculatorService);
+ if (calculatorService == NULL) {
+ fprintf(err, "SUB: Cannot get reference even for %s.\n", CALCULATOR2_SERVICE);
+ }
+ }
+ if (status == CELIX_SUCCESS) {
+ char *token = line;
+ strtok_r(line, " ", &token);
+ char *aStr = strtok_r(NULL, " ", &token);
+ char *bStr = strtok_r(NULL, " ", &token);
+ if(aStr != NULL && bStr != NULL ){
+ bool aNumeric, bNumeric;
+ subCommand_isNumeric(aStr, &aNumeric);
+ subCommand_isNumeric(bStr, &bNumeric);
+ if (aNumeric && bNumeric) {
+ calculator_service_pt calculator = NULL;
+ status = bundleContext_getService(context, calculatorService, (void *) &calculator);
+ if (status == CELIX_SUCCESS && calculator != NULL) {
+ double a = atof(aStr);
+ double b = atof(bStr);
+ double result = 0;
+ status = calculator->sub(calculator->calculator, a, b, &result);
+ if (status == CELIX_SUCCESS) {
+ fprintf(out, "CALCULATOR_SHELL: Sub: %f - %f = %f\n", a, b, result);
+ } else {
+ fprintf(err, "SUB: Unexpected exception in Calc service\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+ } else {
+ fprintf(err, "SUB: Requires 2 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "SUB: Requires 2 numerical parameter\n");
+ }
+ } else {
+ fprintf(err, "No calc service available\n");
+ }
+
+ //return status;
+}
+
+static celix_status_t subCommand_isNumeric(char *number, bool *ret) {
+ celix_status_t status = CELIX_SUCCESS;
+ *ret = true;
+ while(*number) {
+ if(!isdigit(*number) && *number != '.') {
+ *ret = false;
+ break;
+ }
+ number++;
+ }
+ return status;
+}
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/examples/calculator_shell/src/sub_command.h
----------------------------------------------------------------------
diff --git a/remote_services/examples/calculator_shell/src/sub_command.h b/remote_services/examples/calculator_shell/src/sub_command.h
new file mode 100644
index 0000000..cf13616
--- /dev/null
+++ b/remote_services/examples/calculator_shell/src/sub_command.h
@@ -0,0 +1,32 @@
+/**
+ *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.
+ */
+/*
+ * sub_command.h
+ *
+ * \date Oct 13, 2011
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef SUB_COMMAND_H_
+#define SUB_COMMAND_H_
+
+void subCommand_execute(bundle_context_pt context, char *line, FILE *out, FILE *err);
+
+#endif /* SUB_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/remote_service_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin/CMakeLists.txt b/remote_services/remote_service_admin/CMakeLists.txt
deleted file mode 100644
index ac703e2..0000000
--- a/remote_services/remote_service_admin/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# 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.
-
-install (FILES
- public/include/remote_endpoint_impl.h
- public/include/remote_endpoint.h
- public/include/remote_proxy.h
- public/include/remote_service_admin.h
- public/include/export_registration.h
- public/include/import_registration.h
- public/include/endpoint_description.h
- public/include/endpoint_listener.h
- public/include/remote_constants.h
- DESTINATION
- include/celix/remote_service_admin
- COMPONENT
- remote_service_admin
-)
-install (FILES
- private/src/remote_proxy_factory_impl.c
- DESTINATION
- share/celix/remote_service_admin
- COMPONENT
- remote_service_admin
-)
-install (FILES
- public/include/endpoint_listener.h
- DESTINATION
- include/celix/endpoint_listener
- COMPONENT
- remote_service_admin
-)
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/remote_service_admin/README.md
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin/README.md b/remote_services/remote_service_admin/README.md
deleted file mode 100644
index c4bdebd..0000000
--- a/remote_services/remote_service_admin/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-## Remote Service Admin
-
-The Remote Service Admin (RSA) provides the mechanisms to import and export services when instructed to do so by the Topology Manager.
-
-To delegate method calls to the actual service implementation, the RSA_SHM and the RSA_HTTP are using "endpoint/proxy" bundles, which has all the knowledge about the marshalling and unmarshalling of data for the service. The RSA_DFI implementation combines a [foreign function interface](https://en.wikipedia.org/wiki/Foreign_function_interface) technique together with manualy created descriptors.
-
-Note that this folder contains code commonly used by the RSA implementations and therefore does not include any CMAKE configuration.
-
-###### Properties
- ENDPOINTS defines the relative directory where endpoints and proxys can be found (default: endpoints)
- CELIX_FRAMEWORK_EXTENDER_PATH Used in RSA_DFI only. Can be used to define a path to use as an extender path point for the framework bundle. For normal bundles the bundle cache is used.
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/remote_service_admin/private/include/export_registration_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin/private/include/export_registration_impl.h b/remote_services/remote_service_admin/private/include/export_registration_impl.h
deleted file mode 100644
index bb276f9..0000000
--- a/remote_services/remote_service_admin/private/include/export_registration_impl.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- *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.
- */
-/*
- * export_registration_impl.h
- *
- * \date Oct 6, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef EXPORT_REGISTRATION_IMPL_H_
-#define EXPORT_REGISTRATION_IMPL_H_
-
-#include "remote_service_admin.h"
-#include "remote_endpoint.h"
-#include "service_tracker.h"
-#include "log_helper.h"
-
-struct export_registration {
- bundle_context_pt context;
- remote_service_admin_pt rsa;
- endpoint_description_pt endpointDescription;
- service_reference_pt reference;
- log_helper_pt loghelper;
-
- service_tracker_pt tracker;
- service_tracker_pt endpointTracker;
-
- remote_endpoint_service_pt endpoint;
-
- export_reference_pt exportReference;
- bundle_pt bundle;
-
- bool closed;
-};
-
-celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference, endpoint_description_pt endpoint, remote_service_admin_pt rsa, bundle_context_pt context, export_registration_pt *registration);
-celix_status_t exportRegistration_destroy(export_registration_pt *registration);
-celix_status_t exportRegistration_open(export_registration_pt registration);
-
-celix_status_t exportRegistration_setEndpointDescription(export_registration_pt registration, endpoint_description_pt endpointDescription);
-celix_status_t exportRegistration_startTracking(export_registration_pt registration);
-celix_status_t exportRegistration_stopTracking(export_registration_pt registration);
-
-#endif /* EXPORT_REGISTRATION_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/remote_service_admin/private/include/import_registration_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin/private/include/import_registration_impl.h b/remote_services/remote_service_admin/private/include/import_registration_impl.h
deleted file mode 100644
index 7aa397f..0000000
--- a/remote_services/remote_service_admin/private/include/import_registration_impl.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- *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.
- */
-/*
- * import_registration_impl.h
- *
- * \date Oct 14, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef IMPORT_REGISTRATION_IMPL_H_
-#define IMPORT_REGISTRATION_IMPL_H_
-
-#include "remote_service_admin.h"
-#include "remote_proxy.h"
-#include "service_tracker.h"
-#include "log_helper.h"
-
-struct import_registration {
- bundle_context_pt context;
- endpoint_description_pt endpointDescription;
-
- service_reference_pt reference;
- import_reference_pt importReference;
-
- remote_service_admin_pt rsa;
- sendToHandle sendToCallback;
-
- bool closed;
-};
-
-
-
-struct import_registration_factory
-{
- char* serviceName;
- log_helper_pt loghelper;
- remote_proxy_factory_service_pt trackedFactory;
- service_tracker_pt proxyFactoryTracker;
- bundle_context_pt context;
- array_list_pt registrations;
- bundle_pt bundle;
-};
-
-
-celix_status_t importRegistration_create(endpoint_description_pt endpoint, remote_service_admin_pt rsa, sendToHandle callback, bundle_context_pt context, import_registration_pt *registration);
-celix_status_t importRegistration_destroy(import_registration_pt registration);
-
-celix_status_t importRegistration_setEndpointDescription(import_registration_pt registration, endpoint_description_pt endpointDescription);
-celix_status_t importRegistration_setHandler(import_registration_pt registration, void * handler);
-celix_status_t importRegistration_setCallback(import_registration_pt registration, sendToHandle callback);
-
-celix_status_t importRegistration_getException(import_registration_pt registration);
-celix_status_t importRegistration_getImportReference(import_registration_pt registration, import_reference_pt *reference);
-
-celix_status_t importRegistration_createProxyFactoryTracker(import_registration_factory_pt registration_factory, service_tracker_pt *tracker);
-
-celix_status_t importRegistrationFactory_destroy(import_registration_factory_pt* registration_factory);
-//celix_status_t importRegistrationFactory_open(import_registration_factory_pt registration_factory);
-celix_status_t importRegistrationFactory_close(import_registration_factory_pt registration_factory);
-celix_status_t importRegistrationFactory_install(log_helper_pt helper, char* serviceName, bundle_context_pt context, import_registration_factory_pt *registration_factory);
-
-
-
-#endif /* IMPORT_REGISTRATION_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h b/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
deleted file mode 100644
index e8a5e1f..0000000
--- a/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *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.
- */
-/*
- * remote_service_admin_impl.h
- *
- * \date Dec 5, 2013
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef REMOTE_SERVICE_ADMIN_IMPL_H_
-#define REMOTE_SERVICE_ADMIN_IMPL_H_
-
-#include "remote_service_admin.h"
-
-#define BUNDLE_STORE_PROPERTY_NAME "ENDPOINTS"
-#define DEFAULT_BUNDLE_STORE "endpoints"
-
-celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_service_admin_pt *admin);
-celix_status_t remoteServiceAdmin_destroy(remote_service_admin_pt *admin);
-
-celix_status_t remoteServiceAdmin_send(remote_service_admin_pt rsa, endpoint_description_pt endpointDescription, char *methodSignature, char **reply, int* replyStatus);
-
-celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt admin, char *serviceId, properties_pt properties, array_list_pt *registrations);
-celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt registration);
-celix_status_t remoteServiceAdmin_getExportedServices(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_getImportedEndpoints(remote_service_admin_pt admin, array_list_pt *services);
-celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt endpoint, import_registration_pt *registration);
-celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_pt admin, import_registration_pt registration);
-
-celix_status_t remoteServiceAdmin_destroyEndpointDescription(endpoint_description_pt *description);
-
-#endif /* REMOTE_SERVICE_ADMIN_IMPL_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/2a670f26/remote_services/remote_service_admin/private/src/endpoint_description.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin/private/src/endpoint_description.c b/remote_services/remote_service_admin/private/src/endpoint_description.c
deleted file mode 100644
index 0d8b684..0000000
--- a/remote_services/remote_service_admin/private/src/endpoint_description.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *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.
- */
-/*
- * endpoint_description.c
- *
- * \date 25 Jul 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <string.h>
-
-#include "celix_errno.h"
-#include "celix_log.h"
-
-#include "endpoint_description.h"
-#include "remote_constants.h"
-#include "constants.h"
-
-static celix_status_t endpointDescription_verifyLongProperty(properties_pt properties, char *propertyName, unsigned long *longProperty);
-
-celix_status_t endpointDescription_create(properties_pt properties, endpoint_description_pt *endpointDescription) {
- celix_status_t status = CELIX_SUCCESS;
-
- unsigned long serviceId = 0UL;
- status = endpointDescription_verifyLongProperty(properties, (char *) OSGI_RSA_ENDPOINT_SERVICE_ID, &serviceId);
- if (status != CELIX_SUCCESS) {
- return status;
- }
-
- endpoint_description_pt ep = calloc(1,sizeof(*ep));
-
- ep->properties = properties;
- ep->frameworkUUID = (char*)properties_get(properties, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
- ep->id = (char*)properties_get(properties, OSGI_RSA_ENDPOINT_ID);
- ep->service = strndup(properties_get(properties, OSGI_FRAMEWORK_OBJECTCLASS), 1024*10);
- ep->serviceId = serviceId;
-
- if (!(ep->frameworkUUID) || !(ep->id) || !(ep->service) ) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "ENDPOINT_DESCRIPTION: incomplete description!.");
- status = CELIX_BUNDLE_EXCEPTION;
- }
-
- if(status == CELIX_SUCCESS){
- *endpointDescription = ep;
- }
- else{
- *endpointDescription = NULL;
- free(ep);
- }
-
- return status;
-}
-
-celix_status_t endpointDescription_destroy(endpoint_description_pt description) {
- properties_destroy(description->properties);
- free(description->service);
- free(description);
- return CELIX_SUCCESS;
-}
-
-static celix_status_t endpointDescription_verifyLongProperty(properties_pt properties, char *propertyName, unsigned long *longProperty) {
- celix_status_t status = CELIX_SUCCESS;
-
- const char *value = properties_get(properties, propertyName);
- if (value == NULL) {
- *longProperty = 0UL;
- } else {
- *longProperty = strtoul(value,NULL,10);
- }
-
- return status;
-}