-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-685: Update usage of manifest to celix_bundle_manifest and removes…
… some usage of deprecated api
- Loading branch information
Showing
72 changed files
with
753 additions
and
1,473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,18 +16,9 @@ | |
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
/** | ||
* remote_shell.c | ||
* | ||
* \date Nov 4, 2012 | ||
* \author <a href="mailto:[email protected]">Apache Celix Project Team</a> | ||
* \copyright Apache License, Version 2.0 | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include <utils.h> | ||
#include <sys/socket.h> | ||
|
||
#include "celix_log_helper.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,120 +16,110 @@ | |
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
/** | ||
* shell_mediator.c | ||
* | ||
* \date Nov 4, 2012 | ||
* \author <a href="mailto:[email protected]">Apache Celix Project Team</a> | ||
* \copyright Apache License, Version 2.0 | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <utils.h> | ||
#include <celix_shell.h> | ||
#include <service_tracker.h> | ||
#include <sys/socket.h> | ||
|
||
#include "celix_log_helper.h" | ||
#include "celix_shell.h" | ||
#include "service_tracker.h" | ||
#include "shell_mediator.h" | ||
|
||
static celix_status_t shellMediator_addedService(void *handler, service_reference_pt reference, void * service); | ||
static celix_status_t shellMediator_removedService(void *handler, service_reference_pt reference, void * service); | ||
|
||
celix_status_t shellMediator_create(bundle_context_pt context, shell_mediator_pt *instance) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
service_tracker_customizer_pt customizer = NULL; | ||
static celix_status_t shellMediator_addedService(void* handler, service_reference_pt reference, void* service); | ||
static celix_status_t shellMediator_removedService(void* handler, service_reference_pt reference, void* service); | ||
|
||
(*instance) = (shell_mediator_pt) calloc(1, sizeof(**instance)); | ||
if ((*instance) != NULL) { | ||
celix_status_t shellMediator_create(bundle_context_pt context, shell_mediator_pt* instance) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
service_tracker_customizer_pt customizer = NULL; | ||
|
||
(*instance)->context = context; | ||
(*instance)->tracker = NULL; | ||
(*instance)->shellService = NULL; | ||
(*instance) = (shell_mediator_pt)calloc(1, sizeof(**instance)); | ||
if ((*instance) != NULL) { | ||
(*instance)->context = context; | ||
(*instance)->tracker = NULL; | ||
(*instance)->shellService = NULL; | ||
|
||
(*instance)->loghelper = celix_logHelper_create(context, "celix_shell"); | ||
|
||
status = CELIX_DO_IF(status, celixThreadMutex_create(&(*instance)->mutex, NULL)); | ||
|
||
status = CELIX_DO_IF(status, serviceTrackerCustomizer_create((*instance), NULL, shellMediator_addedService, | ||
NULL, shellMediator_removedService, &customizer)); | ||
status = CELIX_DO_IF(status, serviceTracker_create(context, (char * )CELIX_SHELL_SERVICE_NAME, customizer, &(*instance)->tracker)); | ||
|
||
if (status == CELIX_SUCCESS) { | ||
serviceTracker_open((*instance)->tracker); | ||
} | ||
} else { | ||
status = CELIX_ENOMEM; | ||
} | ||
|
||
if ((status != CELIX_SUCCESS) && ((*instance) != NULL)){ | ||
celix_logHelper_log((*instance)->loghelper, CELIX_LOG_LEVEL_ERROR, "Error creating shell_mediator, error code is %i\n", status); | ||
} | ||
return status; | ||
status = CELIX_DO_IF(status, celixThreadMutex_create(&(*instance)->mutex, NULL)); | ||
|
||
status = CELIX_DO_IF( | ||
status, | ||
serviceTrackerCustomizer_create( | ||
(*instance), NULL, shellMediator_addedService, NULL, shellMediator_removedService, &customizer)); | ||
status = CELIX_DO_IF( | ||
status, serviceTracker_create(context, (char*)CELIX_SHELL_SERVICE_NAME, customizer, &(*instance)->tracker)); | ||
|
||
if (status == CELIX_SUCCESS) { | ||
serviceTracker_open((*instance)->tracker); | ||
} | ||
} else { | ||
status = CELIX_ENOMEM; | ||
} | ||
|
||
if ((status != CELIX_SUCCESS) && ((*instance) != NULL)) { | ||
celix_logHelper_log( | ||
(*instance)->loghelper, CELIX_LOG_LEVEL_ERROR, "Error creating shell_mediator, error code is %i\n", status); | ||
} | ||
return status; | ||
} | ||
|
||
celix_status_t shellMediator_stop(shell_mediator_pt instance) { | ||
service_tracker_pt tracker; | ||
celixThreadMutex_lock(&instance->mutex); | ||
tracker = instance->tracker; | ||
celixThreadMutex_unlock(&instance->mutex); | ||
service_tracker_pt tracker; | ||
celixThreadMutex_lock(&instance->mutex); | ||
tracker = instance->tracker; | ||
celixThreadMutex_unlock(&instance->mutex); | ||
|
||
if (tracker != NULL) { | ||
serviceTracker_close(tracker); | ||
} | ||
if (tracker != NULL) { | ||
serviceTracker_close(tracker); | ||
} | ||
|
||
return CELIX_SUCCESS; | ||
} | ||
|
||
celix_status_t shellMediator_destroy(shell_mediator_pt instance) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
celix_status_t status = CELIX_SUCCESS; | ||
|
||
celixThreadMutex_lock(&instance->mutex); | ||
celixThreadMutex_lock(&instance->mutex); | ||
|
||
instance->shellService = NULL; | ||
serviceTracker_destroy(instance->tracker); | ||
instance->shellService = NULL; | ||
serviceTracker_destroy(instance->tracker); | ||
celix_logHelper_destroy(instance->loghelper); | ||
celixThreadMutex_destroy(&instance->mutex); | ||
celixThreadMutex_destroy(&instance->mutex); | ||
|
||
free(instance); | ||
|
||
free(instance); | ||
|
||
|
||
return status; | ||
return status; | ||
} | ||
|
||
celix_status_t shellMediator_executeCommand(shell_mediator_pt instance, char *command, FILE *out, FILE *err) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
|
||
celixThreadMutex_lock(&instance->mutex); | ||
celix_status_t shellMediator_executeCommand(shell_mediator_pt instance, char* command, FILE* out, FILE* err) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
|
||
celixThreadMutex_lock(&instance->mutex); | ||
|
||
if (instance->shellService != NULL) { | ||
instance->shellService->executeCommand(instance->shellService->handle, command, out, err); | ||
} | ||
if (instance->shellService != NULL) { | ||
instance->shellService->executeCommand(instance->shellService->handle, command, out, err); | ||
} | ||
|
||
celixThreadMutex_unlock(&instance->mutex); | ||
celixThreadMutex_unlock(&instance->mutex); | ||
|
||
return status; | ||
return status; | ||
} | ||
|
||
static celix_status_t shellMediator_addedService(void *handler, service_reference_pt reference, void * service) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
shell_mediator_pt instance = (shell_mediator_pt) handler; | ||
celixThreadMutex_lock(&instance->mutex); | ||
instance->shellService = (celix_shell_t*) service; | ||
celixThreadMutex_unlock(&instance->mutex); | ||
return status; | ||
static celix_status_t shellMediator_addedService(void* handler, service_reference_pt reference, void* service) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
shell_mediator_pt instance = (shell_mediator_pt)handler; | ||
celixThreadMutex_lock(&instance->mutex); | ||
instance->shellService = (celix_shell_t*)service; | ||
celixThreadMutex_unlock(&instance->mutex); | ||
return status; | ||
} | ||
|
||
|
||
static celix_status_t shellMediator_removedService(void *handler, service_reference_pt reference, void * service) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
shell_mediator_pt instance = (shell_mediator_pt) handler; | ||
celixThreadMutex_lock(&instance->mutex); | ||
instance->shellService = NULL; | ||
celixThreadMutex_unlock(&instance->mutex); | ||
return status; | ||
static celix_status_t shellMediator_removedService(void* handler, service_reference_pt reference, void* service) { | ||
celix_status_t status = CELIX_SUCCESS; | ||
shell_mediator_pt instance = (shell_mediator_pt)handler; | ||
celixThreadMutex_lock(&instance->mutex); | ||
instance->shellService = NULL; | ||
celixThreadMutex_unlock(&instance->mutex); | ||
return status; | ||
} | ||
|
Oops, something went wrong.