Apache Celix  2.3.0
An implementation of the OSGi specification adapted to C and C++
celix_framework.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef CELIX_FRAMEWORK_H_
21 #define CELIX_FRAMEWORK_H_
22 
23 
24 #include "celix_types.h"
25 #include "celix_properties.h"
26 #include "celix_log_level.h"
27 #include "celix_array_list.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 const char* celix_framework_getUUID(const celix_framework_t *fw);
38 
45 celix_bundle_context_t* celix_framework_getFrameworkContext(const celix_framework_t *fw);
46 
53 celix_bundle_t* celix_framework_getFrameworkBundle(const celix_framework_t *fw);
54 
65 void celix_framework_useBundles(celix_framework_t *fw, bool includeFrameworkBundle, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd));
66 
79 bool celix_framework_useBundle(celix_framework_t *fw, bool onlyActive, long bndId, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd));
80 
87 bool celix_framework_isBundleInstalled(celix_framework_t *fw, long bndId);
88 
95 bool celix_framework_isBundleActive(celix_framework_t *fw, long bndId);
96 
97 
107 long celix_framework_installBundle(celix_framework_t *fw, const char *bundleLoc, bool autoStart);
108 
117 bool celix_framework_uninstallBundle(celix_framework_t *fw, long bndId);
118 
127 bool celix_framework_stopBundle(celix_framework_t *fw, long bndId);
128 
137 bool celix_framework_startBundle(celix_framework_t *fw, long bndId);
138 
150 long celix_framework_installBundleAsync(celix_framework_t *fw, const char *bundleLoc, bool autoStart);
151 
161 void celix_framework_uninstallBundleAsync(celix_framework_t *fw, long bndId);
162 
172 void celix_framework_stopBundleAsync(celix_framework_t *fw, long bndId);
173 
183 void celix_framework_startBundleAsync(celix_framework_t *fw, long bndId);
184 
192 celix_array_list_t* celix_framework_listBundles(celix_framework_t* framework);
193 
201 celix_array_list_t* celix_framework_listInstalledBundles(celix_framework_t* framework);
202 
212 void celix_framework_waitForEmptyEventQueue(celix_framework_t *fw);
213 
221 void celix_framework_setLogCallback(celix_framework_t* fw, void* logHandle, void (*logFunction)(void* handle, celix_log_level_e level, const char* file, const char *function, int line, const char *format, va_list formatArgs));
222 
223 
227 void celix_framework_waitUntilNoEventsForBnd(celix_framework_t* fw, long bndId);
228 
232 void celix_framework_waitUntilNoPendingRegistration(celix_framework_t* fw);
233 
237 bool celix_framework_isCurrentThreadTheEventLoop(celix_framework_t* fw);
238 
239 
249 long celix_framework_fireGenericEvent(celix_framework_t* fw, long eventId, long bndId, const char *eventName, void* processData, void (*processCallback)(void *data), void* doneData, void (*doneCallback)(void* doneData));
250 
258 long celix_framework_nextEventId(celix_framework_t *fw);
259 
264 void celix_framework_waitForGenericEvent(celix_framework_t *fw, long eventId);
265 
269 void celix_framework_waitForStop(celix_framework_t *framework);
270 
271 #ifdef __cplusplus
272 }
273 #endif
274 
275 #endif /* CELIX_FRAMEWORK_H_ */
celix_framework_stopBundle
bool celix_framework_stopBundle(celix_framework_t *fw, long bndId)
Stop the bundle with the provided bundle id. Will silently ignore bundle ids < 0.
celix_framework_setLogCallback
void celix_framework_setLogCallback(celix_framework_t *fw, void *logHandle, void(*logFunction)(void *handle, celix_log_level_e level, const char *file, const char *function, int line, const char *format, va_list formatArgs))
Sets the log function for this framework. Default the celix framework will log to stdout/stderr.
celix_framework_waitForGenericEvent
void celix_framework_waitForGenericEvent(celix_framework_t *fw, long eventId)
Wait until a event with the provided event id is completely handled. This function will directly retu...
celix_framework_fireGenericEvent
long celix_framework_fireGenericEvent(celix_framework_t *fw, long eventId, long bndId, const char *eventName, void *processData, void(*processCallback)(void *data), void *doneData, void(*doneCallback)(void *doneData))
Fire a generic event. The event will be added to the event loop and handled on the event loop thread.
celix_framework_waitForStop
void celix_framework_waitForStop(celix_framework_t *framework)
Wait until the framework is stopped.
celix_framework_startBundle
bool celix_framework_startBundle(celix_framework_t *fw, long bndId)
Start the bundle with the provided bundle id. Will silently ignore bundle ids < 0.
celix_framework_nextEventId
long celix_framework_nextEventId(celix_framework_t *fw)
Get the next event id.
celix_framework_uninstallBundle
bool celix_framework_uninstallBundle(celix_framework_t *fw, long bndId)
Uninstall the bundle with the provided bundle id. If needed the bundle will be stopped first....
celix_framework_waitUntilNoEventsForBnd
void celix_framework_waitUntilNoEventsForBnd(celix_framework_t *fw, long bndId)
wait until all events for the bundle identified by the bndId are processed.
celix_framework_getFrameworkBundle
celix_bundle_t * celix_framework_getFrameworkBundle(const celix_framework_t *fw)
Returns the framework bundle. This is the same as a 'normal' bundle, expect that this bundle cannot b...
celix_framework_installBundleAsync
long celix_framework_installBundleAsync(celix_framework_t *fw, const char *bundleLoc, bool autoStart)
Install and optional start a bundle async. Will silently ignore bundle ids < 0.
celix_framework_stopBundleAsync
void celix_framework_stopBundleAsync(celix_framework_t *fw, long bndId)
Stop the bundle with the provided bundle id async. Will silently ignore bundle ids < 0.
celix_framework_isBundleInstalled
bool celix_framework_isBundleInstalled(celix_framework_t *fw, long bndId)
Check whether a bundle is installed.
celix_framework_getUUID
const char * celix_framework_getUUID(const celix_framework_t *fw)
Returns the framework UUID. This is unique for every created framework and will not be the same if th...
celix_framework_useBundles
void celix_framework_useBundles(celix_framework_t *fw, bool includeFrameworkBundle, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd))
Use the currently active (started) bundles. The provided callback will be called for all the currentl...
celix_framework_isBundleActive
bool celix_framework_isBundleActive(celix_framework_t *fw, long bndId)
Check whether the bundle is active.
celix_framework_uninstallBundleAsync
void celix_framework_uninstallBundleAsync(celix_framework_t *fw, long bndId)
Uninstall the bundle with the provided bundle id async. If needed the bundle will be stopped first....
celix_framework_installBundle
long celix_framework_installBundle(celix_framework_t *fw, const char *bundleLoc, bool autoStart)
Install and optional start a bundle. Will silently ignore bundle ids < 0.
celix_framework_waitForEmptyEventQueue
void celix_framework_waitForEmptyEventQueue(celix_framework_t *fw)
Wait until the framework event queue is empty.
celix_framework_getFrameworkContext
celix_bundle_context_t * celix_framework_getFrameworkContext(const celix_framework_t *fw)
Returns the framework bundle context. This is the same as a 'normal' bundle context and can be used t...
celix_framework_waitUntilNoPendingRegistration
void celix_framework_waitUntilNoPendingRegistration(celix_framework_t *fw)
wait until all pending service registration are processed.
celix_framework_isCurrentThreadTheEventLoop
bool celix_framework_isCurrentThreadTheEventLoop(celix_framework_t *fw)
Returns whether the current thread is the Celix framework event loop thread.
celix_framework_startBundleAsync
void celix_framework_startBundleAsync(celix_framework_t *fw, long bndId)
Start the bundle with the provided bundle id async. Will silently ignore bundle ids < 0.
celix_framework_listBundles
celix_array_list_t * celix_framework_listBundles(celix_framework_t *framework)
List the installed and started bundle ids. The bundle ids does not include the framework bundle (bund...
celix_framework_listInstalledBundles
celix_array_list_t * celix_framework_listInstalledBundles(celix_framework_t *framework)
List the installed bundle ids. The bundle ids does not include the framework bundle (bundle id CELIX_...
celix_framework_useBundle
bool celix_framework_useBundle(celix_framework_t *fw, bool onlyActive, long bndId, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd))
Use the bundle with the provided bundle id The provided callback will be called if the bundle is foun...