1 /* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6 
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation.  The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License, version 2.0, for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #include <mysql/components/component_implementation.h>
24 #include <mysql/components/service_implementation.h>
25 #include "english_greeting_service_imp.h"
26 #include "example_services.h"
27 #include "simple_example_math_imp.h"
28 
29 /**
30   This file contains a definition of the example_component1.
31 */
32 
33 /**
34   Initialization entry method for Component used when loading the Component.
35 
36   @return Status of performed operation
37   @retval 0 success
38   @retval non-zero failure
39 */
example_init()40 mysql_service_status_t example_init() { return 0; }
41 
42 /**
43   De-initialization method for Component used when unloading the Component.
44 
45   @return Status of performed operation
46   @retval 0 success
47   @retval non-zero failure
48 */
example_deinit()49 mysql_service_status_t example_deinit() { return 0; }
50 
51 /* This component provides an implementation for all example Services. */
52 BEGIN_SERVICE_IMPLEMENTATION(example_component1, greetings)
53 english_greeting_service_imp::say_hello, END_SERVICE_IMPLEMENTATION();
54 
55 BEGIN_SERVICE_IMPLEMENTATION(example_component1, greetings_localization)
56 english_greeting_service_imp::get_language, END_SERVICE_IMPLEMENTATION();
57 
58 BEGIN_SERVICE_IMPLEMENTATION(example_component1, example_math)
59 simple_example_math_imp::calculate_gcd, END_SERVICE_IMPLEMENTATION();
60 
61 BEGIN_COMPONENT_PROVIDES(example_component1)
62 PROVIDES_SERVICE(example_component1, greetings),
63     PROVIDES_SERVICE(example_component1, greetings_localization),
64     PROVIDES_SERVICE(example_component1, example_math),
65     END_COMPONENT_PROVIDES();
66 
67 /* An empty list of dependencies. */
68 BEGIN_COMPONENT_REQUIRES(example_component1) END_COMPONENT_REQUIRES();
69 
70 /* A list of metadata to describe the Component. */
71 BEGIN_COMPONENT_METADATA(example_component1)
72 METADATA("mysql.author", "Oracle Corporation"),
73     METADATA("mysql.license", "GPL"), METADATA("test_property", "1"),
74     END_COMPONENT_METADATA();
75 
76 /* Declaration of the Component. */
77 DECLARE_COMPONENT(example_component1, "mysql:example_component1")
78 example_init, example_deinit END_DECLARE_COMPONENT();
79 
80 /* Defines list of Components contained in this library. Note that for now
81   we assume that library will have exactly one Component. */
82 DECLARE_LIBRARY_COMPONENTS &COMPONENT_REF(example_component1)
83     END_DECLARE_LIBRARY_COMPONENTS
84