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 2015/03/27 17:36:31 UTC
celix git commit: CELIX-230: Initial refatoring. Got ps up again,
usage and description not yet working.
Repository: celix
Updated Branches:
refs/heads/shell_command [created] cea3f9ec0
CELIX-230: Initial refatoring. Got ps up again, usage and description not yet working.
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/cea3f9ec
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/cea3f9ec
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/cea3f9ec
Branch: refs/heads/shell_command
Commit: cea3f9ec04d0ff8dcc76e3c38ba60dc7a55d250f
Parents: b3271bc
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Fri Mar 27 17:35:00 2015 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Fri Mar 27 17:35:00 2015 +0100
----------------------------------------------------------------------
framework/private/src/service_reference.c | 2 +-
launcher/private/src/launcher.c | 2 +
shell/CMakeLists.txt | 28 +---
shell/private/include/help_command.h | 33 ----
shell/private/include/inspect_command.h | 33 ----
shell/private/include/install_command.h | 33 ----
shell/private/include/log_command.h | 33 ----
shell/private/include/ps_command.h | 33 ----
shell/private/include/start_command.h | 33 ----
shell/private/include/std_commands.h | 40 +++++
shell/private/include/stop_command.h | 33 ----
shell/private/include/uninstall_command.h | 33 ----
shell/private/include/update_command.h | 35 -----
shell/private/src/activator.c | 192 +++++++++--------------
shell/private/src/ps_command.c | 209 ++++++++++++-------------
shell/private/src/shell.c | 64 ++++----
shell/public/include/command.h | 11 +-
shell/public/include/command_impl.h | 48 ------
shell/public/include/shell.h | 1 -
shell/public/src/command.c | 45 ------
20 files changed, 252 insertions(+), 689 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/framework/private/src/service_reference.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_reference.c b/framework/private/src/service_reference.c
index 9f954c5..a9bfff4 100644
--- a/framework/private/src/service_reference.c
+++ b/framework/private/src/service_reference.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <constants.h>
+#include <stdint.h>
#include "service_reference.h"
@@ -37,7 +38,6 @@
#include "bundle.h"
#include "celix_log.h"
-
celix_status_t serviceReference_create(bundle_pt bundle, service_registration_pt registration, service_reference_pt *reference) {
celix_status_t status = CELIX_SUCCESS;
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/launcher/private/src/launcher.c
----------------------------------------------------------------------
diff --git a/launcher/private/src/launcher.c b/launcher/private/src/launcher.c
index 139d355..1a1f71e 100644
--- a/launcher/private/src/launcher.c
+++ b/launcher/private/src/launcher.c
@@ -27,6 +27,8 @@
#include <string.h>
#include <stdlib.h>
#include <libgen.h>
+#include <signal.h>
+
#include <curl/curl.h>
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt
index 07f4c6e..8308369 100644
--- a/shell/CMakeLists.txt
+++ b/shell/CMakeLists.txt
@@ -23,30 +23,18 @@ if (SHELL)
SET_HEADERS("Bundle-Name: Apache Celix Shell")
bundle(shell SOURCES
- public/src/command
private/src/activator
private/src/shell
private/src/ps_command
- private/src/start_command
- private/src/stop_command
- private/src/install_command
- private/src/update_command
- private/src/uninstall_command
- private/src/log_command
- private/src/inspect_command
- private/src/help_command
-
- private/include/inspect_command.h
- private/include/install_command.h
- private/include/log_command.h
- private/include/ps_command.h
- private/include/shell_private.h
- private/include/start_command.h
- private/include/stop_command.h
- private/include/uninstall_command.h
- private/include/update_command.h
- private/include/help_command.h
+ # private/src/start_command
+ #private/src/stop_command
+ #private/src/install_command
+ #private/src/update_command
+ #private/src/uninstall_command
+ #private/src/log_command
+ #private/src/inspect_command
+ #private/src/help_command
)
install_bundle(shell
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/help_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/help_command.h b/shell/private/include/help_command.h
deleted file mode 100644
index a975cbf..0000000
--- a/shell/private/include/help_command.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * help_command.h
- *
- * \date Aug 20, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef HELP_COMMAND_H_
-#define HELP_COMMAND_H_
-
-command_pt helpCommand_create(bundle_context_pt context);
-void helpCommand_destroy(command_pt command);
-
-#endif /* HELP_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/inspect_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/inspect_command.h b/shell/private/include/inspect_command.h
deleted file mode 100644
index 7ea9e8e..0000000
--- a/shell/private/include/inspect_command.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * inspect_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 INSPECT_COMMAND_H_
-#define INSPECT_COMMAND_H_
-
-command_pt inspectCommand_create(bundle_context_pt context);
-void inspectCommand_destroy(command_pt command);
-
-#endif /* INSPECT_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/install_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/install_command.h b/shell/private/include/install_command.h
deleted file mode 100644
index a8a6571..0000000
--- a/shell/private/include/install_command.h
+++ /dev/null
@@ -1,33 +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_command.h
- *
- * \date Apr 4, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef INSTALL_COMMAND_H_
-#define INSTALL_COMMAND_H_
-
-command_pt installCommand_create(bundle_context_pt context);
-void installCommand_destroy(command_pt command);
-
-#endif /* INSTALL_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/log_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/log_command.h b/shell/private/include/log_command.h
deleted file mode 100644
index 4eac17c..0000000
--- a/shell/private/include/log_command.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * log_command.h
- *
- * \date Jun 26, 2011
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef LOG_COMMAND_H_
-#define LOG_COMMAND_H_
-
-command_pt logCommand_create(bundle_context_pt context);
-void logCommand_destroy(command_pt command);
-
-#endif /* LOG_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/ps_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/ps_command.h b/shell/private/include/ps_command.h
deleted file mode 100644
index 941a9f4..0000000
--- a/shell/private/include/ps_command.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * ps_command.h
- *
- * \date Aug 13, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef PS_COMMAND_H_
-#define PS_COMMAND_H_
-
-command_pt psCommand_create(bundle_context_pt context);
-void psCommand_destroy(command_pt command);
-
-#endif /* PS_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/start_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/start_command.h b/shell/private/include/start_command.h
deleted file mode 100644
index 3d76062..0000000
--- a/shell/private/include/start_command.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * start_command.h
- *
- * \date Aug 20, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef START_COMMAND_H_
-#define START_COMMAND_H_
-
-command_pt startCommand_create(bundle_context_pt context);
-void startCommand_destroy(command_pt command);
-
-#endif /* START_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/std_commands.h
----------------------------------------------------------------------
diff --git a/shell/private/include/std_commands.h b/shell/private/include/std_commands.h
new file mode 100644
index 0000000..cb7322c
--- /dev/null
+++ b/shell/private/include/std_commands.h
@@ -0,0 +1,40 @@
+/**
+ *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.
+ */
+/*
+ * std_commands.h
+ *
+ * \date March 27, 2014
+ * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef __STD_COMMANDS_H_
+#define __STD_COMMANDS_H_
+
+celix_status_t psCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t startCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t stopCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t installCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t uninstallCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t updateCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t logCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t inspectCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+celix_status_t helpCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream);
+
+#endif
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/stop_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/stop_command.h b/shell/private/include/stop_command.h
deleted file mode 100644
index 3b93924..0000000
--- a/shell/private/include/stop_command.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * stop_command.h
- *
- * \date Aug 20, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef STOP_COMMAND_H_
-#define STOP_COMMAND_H_
-
-command_pt stopCommand_create(bundle_context_pt context);
-void stopCommand_destroy(command_pt command);
-
-#endif /* STOP_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/uninstall_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/uninstall_command.h b/shell/private/include/uninstall_command.h
deleted file mode 100644
index 2e2fe97..0000000
--- a/shell/private/include/uninstall_command.h
+++ /dev/null
@@ -1,33 +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.
- */
-/*
- * uninstall_command.h
- *
- * \date Aug 20, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef UNINSTALL_COMMAND_H_
-#define UNINSTALL_COMMAND_H_
-
-command_pt uninstallCommand_create(bundle_context_pt context);
-void uninstallCommand_destroy(command_pt command);
-
-#endif /* UNINSTALL_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/include/update_command.h
----------------------------------------------------------------------
diff --git a/shell/private/include/update_command.h b/shell/private/include/update_command.h
deleted file mode 100644
index 0b83928..0000000
--- a/shell/private/include/update_command.h
+++ /dev/null
@@ -1,35 +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.
- */
-/*
- * update_command.h
- *
- * \date Aug 20, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef UPDATE_COMMAND_H_
-#define UPDATE_COMMAND_H_
-
-#include "command.h"
-
-command_pt updateCommand_create(bundle_context_pt context);
-void updateCommand_destroy(command_pt command);
-
-#endif /* UPDATE_COMMAND_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/src/activator.c
----------------------------------------------------------------------
diff --git a/shell/private/src/activator.c b/shell/private/src/activator.c
index 92ba36e..595894e 100644
--- a/shell/private/src/activator.c
+++ b/shell/private/src/activator.c
@@ -28,32 +28,40 @@
#include "shell_private.h"
#include "bundle_activator.h"
-#include "command_impl.h"
#include "bundle_context.h"
#include "service_registration.h"
#include "service_listener.h"
+#include "utils.h"
+#include "std_commands.h"
+#include "properties.h"
+
+struct command {
+ celix_status_t (*exec)(void *handle, char *commandLine, FILE *out, FILE *err);
+ char *name;
+ char *description;
+ char *usage;
+ command_service_pt service;
+ service_registration_pt reg;
+ properties_pt props;
+};
-#include "ps_command.h"
-#include "start_command.h"
-#include "stop_command.h"
-#include "install_command.h"
-#include "uninstall_command.h"
-#include "update_command.h"
-#include "log_command.h"
-#include "inspect_command.h"
-#include "help_command.h"
+static struct command std_commands[] = {
+ {psCommand_execute, "ps", "list installed bundles.", "ps [-l | -s | -u]", NULL, NULL, NULL},
+ {NULL, NULL, NULL, NULL, NULL, NULL, NULL} /*marker for last element*/
+};
-#include "utils.h"
struct bundle_instance {
shell_service_pt shellService;
service_registration_pt registration;
service_listener_pt listener;
- service_registration_pt psCommand;
- command_pt psCmd;
- command_service_pt psCmdSrv;
+ service_registration_pt commandRegistrations;
+ command_service_pt commandServices;
+ properties_pt commandProperties;
+ /*
+ ps
service_registration_pt startCommand;
command_pt startCmd;
command_service_pt startCmdSrv;
@@ -85,29 +93,11 @@ struct bundle_instance {
service_registration_pt helpCommand;
command_pt helpCmd;
command_service_pt helpCmdSrv;
+ */
};
typedef struct bundle_instance *bundle_instance_pt;
-static celix_status_t shell_createCommandService(command_pt command, command_service_pt *commandService) {
- celix_status_t status = CELIX_SUCCESS;
-
- *commandService = calloc(1, sizeof(**commandService));
-
- if (!*commandService) {
- status = CELIX_ENOMEM;
- }
- else {
- (*commandService)->command = command;
- (*commandService)->executeCommand = command->executeCommand;
- (*commandService)->getName = command_getName;
- (*commandService)->getShortDescription = command_getShortDescription;
- (*commandService)->getUsage = command_getUsage;
- }
-
- return status;
-}
-
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
@@ -121,20 +111,32 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData
free(bi);
}
else {
- bi->listener = NULL;
- bi->psCommand = NULL;
- bi->startCommand = NULL;
- bi->stopCommand = NULL;
- bi->installCommand = NULL;
- bi->uninstallCommand = NULL;
- bi->updateCommand = NULL;
- bi->logCommand = NULL;
- bi->inspectCommand = NULL;
- bi->helpCommand = NULL;
- bi->registration = NULL;
-
status = shell_create(context, &bi->shellService);
+ int i = 0;
+ while (std_commands[i].exec != NULL) {
+ std_commands[i].props = properties_create();
+ if (std_commands[i].props != NULL) {
+ properties_set(std_commands[i].props, "command.name", std_commands[i].name);
+ properties_set(std_commands[i].props, "command.usage", std_commands[i].usage);
+ properties_set(std_commands[i].props, "command.description", std_commands[i].description);
+
+ std_commands[i].service = calloc(1, sizeof(struct commandService));
+ if (std_commands[i].service != NULL) {
+ std_commands[i].service->handle = context;
+ std_commands[i].service->executeCommand = std_commands[i].exec;
+ } else {
+ status = CELIX_ENOMEM;
+ break;
+ }
+ } else {
+ status = CELIX_ENOMEM;
+ break;
+ }
+
+ i += 1;
+ }
+
if (status != CELIX_SUCCESS) {
printf("shell_create failed\n");
}
@@ -171,41 +173,15 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
}
if (status == CELIX_SUCCESS) {
- bi->psCmd = psCommand_create(context);
- shell_createCommandService(bi->psCmd, &bi->psCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->psCmdSrv, NULL, &bi->psCommand);
- bi->startCmd = startCommand_create(context);
- shell_createCommandService(bi->startCmd, &bi->startCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->startCmdSrv, NULL, &bi->startCommand);
+ int i = 0;
+ while (std_commands[i].exec != NULL) {
+ status = bundleContext_registerService(context, (char *)OSGI_SHELL_COMMAND_SERVICE_NAME, std_commands[i].service, std_commands[i].props, &std_commands[i].reg);
+ if (status != CELIX_SUCCESS) {
+ break;
+ }
+ }
- bi->stopCmd = stopCommand_create(context);
- shell_createCommandService(bi->stopCmd, &bi->stopCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->stopCmdSrv, NULL, &bi->stopCommand);
-
- bi->installCmd = installCommand_create(context);
- shell_createCommandService(bi->installCmd, &bi->installCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->installCmdSrv, NULL, &bi->installCommand);
-
- bi->uninstallCmd = uninstallCommand_create(context);
- shell_createCommandService(bi->uninstallCmd, &bi->uninstallCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->uninstallCmdSrv, NULL, &bi->uninstallCommand);
-
- bi->updateCmd = updateCommand_create(context);
- shell_createCommandService(bi->updateCmd, &bi->updateCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->updateCmdSrv, NULL, &bi->updateCommand);
-
- bi->logCmd = logCommand_create(context);
- shell_createCommandService(bi->logCmd, &bi->logCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->logCmdSrv, NULL, &bi->logCommand);
-
- bi->inspectCmd = inspectCommand_create(context);
- shell_createCommandService(bi->inspectCmd, &bi->inspectCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->inspectCmdSrv, NULL, &bi->inspectCommand);
-
- bi->helpCmd = helpCommand_create(context);
- shell_createCommandService(bi->helpCmd, &bi->helpCmdSrv);
- bundleContext_registerService(context, (char *) OSGI_SHELL_COMMAND_SERVICE_NAME, bi->helpCmdSrv, NULL, &bi->helpCommand);
}
arrayList_destroy(references);
}
@@ -217,16 +193,13 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
celix_status_t status = CELIX_SUCCESS;
bundle_instance_pt bi = (bundle_instance_pt) userData;
- serviceRegistration_unregister(bi->registration);
- serviceRegistration_unregister(bi->psCommand);
- serviceRegistration_unregister(bi->startCommand);
- serviceRegistration_unregister(bi->stopCommand);
- serviceRegistration_unregister(bi->installCommand);
- serviceRegistration_unregister(bi->uninstallCommand);
- serviceRegistration_unregister(bi->updateCommand);
- serviceRegistration_unregister(bi->logCommand);
- serviceRegistration_unregister(bi->inspectCommand);
- serviceRegistration_unregister(bi->helpCommand);
+ //serviceRegistration_unregister(bi->registration);
+ int i = 0;
+ while (std_commands[i].exec != NULL) {
+ if (std_commands[i].reg!= NULL) {
+ serviceRegistration_unregister(std_commands[i].reg);
+ }
+ }
status = bundleContext_removeServiceListener(context, bi->listener);
@@ -236,39 +209,16 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context)
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
bundle_instance_pt bi = (bundle_instance_pt) userData;
- psCommand_destroy(bi->psCmd);
- free(bi->psCmdSrv);
-
- startCommand_destroy(bi->startCmd);
- free(bi->startCmdSrv);
-
- stopCommand_destroy(bi->stopCmd);
- free(bi->stopCmdSrv);
-
- installCommand_destroy(bi->installCmd);
- free(bi->installCmdSrv);
-
- uninstallCommand_destroy(bi->uninstallCmd);
- free(bi->uninstallCmdSrv);
-
- updateCommand_destroy(bi->updateCmd);
- free(bi->updateCmdSrv);
-
- logCommand_destroy(bi->logCmd);
- free(bi->logCmdSrv);
-
- inspectCommand_destroy(bi->inspectCmd);
- free(bi->inspectCmdSrv);
-
- inspectCommand_destroy(bi->helpCmd);
- free(bi->helpCmdSrv);
-
- free(bi->listener);
- bi->listener = NULL;
-
- shell_destroy(&bi->shellService);
- bi->shellService = NULL;
- free(bi);
+ int i = 0;
+ while (std_commands[i].exec != NULL) {
+ if (std_commands[i].props != NULL) {
+ properties_destroy(std_commands[i].props);
+ }
+ if (std_commands[i].service != NULL) {
+ free(std_commands[i].service);
+ }
+ i += 1;
+ }
return CELIX_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/src/ps_command.c
----------------------------------------------------------------------
diff --git a/shell/private/src/ps_command.c b/shell/private/src/ps_command.c
index fbc6470..7511391 100644
--- a/shell/private/src/ps_command.c
+++ b/shell/private/src/ps_command.c
@@ -17,134 +17,117 @@
*under the License.
*/
/*
- * ps_command.c
+ * std_shell_commands.c
*
- * \date Aug 13, 2010
+ * \date March 27, 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 "command_impl.h"
#include "array_list.h"
#include "bundle_context.h"
#include "bundle_archive.h"
#include "module.h"
#include "bundle.h"
-char * psCommand_stateString(bundle_state_e state);
-void psCommand_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *));
-
-command_pt psCommand_create(bundle_context_pt context) {
- command_pt command = (command_pt) malloc(sizeof(*command));
- command->bundleContext = context;
- command->name = "ps";
- command->shortDescription = "list installed bundles.";
- command->usage = "ps [-l | -s | -u]";
- command->executeCommand = psCommand_execute;
- return command;
-}
-
-void psCommand_destroy(command_pt command) {
- free(command);
-}
-
-void psCommand_execute(command_pt command, char * commandline, void (*out)(char *), void (*err)(char *)) {
- array_list_pt bundles = NULL;
- celix_status_t status = bundleContext_getBundles(command->bundleContext, &bundles);
-
- if (status == CELIX_SUCCESS) {
- bool showLocation = false;
- bool showSymbolicName = false;
- bool showUpdateLocation = false;
- char * msg = "Name";
- char line[256];
- unsigned int i;
-
- char delims[] = " ";
- char * sub = NULL;
- char *save_ptr = NULL;
- sub = strtok_r(commandline, delims, &save_ptr);
- sub = strtok_r(NULL, delims, &save_ptr);
- while (sub != NULL) {
- if (strcmp(sub, "-l") == 0) {
- showLocation = true;
- msg = "Location";
- } else if (strcmp(sub, "-s") == 0) {
- showSymbolicName = true;
- msg = "Symbolic name";
- } else if (strcmp(sub, "-u") == 0) {
- showUpdateLocation = true;
- msg = "Update location";
- }
- sub = strtok_r(NULL, delims, &save_ptr);
- }
-
- sprintf(line, " %-5s %-12s %s\n", "ID", "State", msg);
- out(line);
-
- unsigned int size = arrayList_size(bundles);
- bundle_pt bundlesA[size];
- for (i = 0; i < size; i++) {
- bundlesA[i] = arrayList_get(bundles, i);
- }
-
- int j;
- for(i=0; i < size - 1; i++) {
- for(j=i+1; j < size; j++) {
- bundle_pt first = bundlesA[i];
- bundle_pt second = bundlesA[j];
-
- bundle_archive_pt farchive = NULL, sarchive = NULL;
- long fid, sid;
-
- bundle_getArchive(first, &farchive);
- bundleArchive_getId(farchive, &fid);
- bundle_getArchive(second, &sarchive);
- bundleArchive_getId(sarchive, &sid);
-
- if(fid > sid)
- {
- // these three lines swap the elements bundles[i] and bundles[j].
- bundle_pt temp = bundlesA[i];
- bundlesA[i] = bundlesA[j];
- bundlesA[j] = temp;
- }
- }
- }
- for (i = 0; i < size; i++) {
- //bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
- bundle_pt bundle = bundlesA[i];
- bundle_archive_pt archive = NULL;
- long id;
- bundle_state_e state;
- char * stateString = NULL;
- module_pt module = NULL;
- char * name = NULL;
-
- bundle_getArchive(bundle, &archive);
- bundleArchive_getId(archive, &id);
- bundle_getState(bundle, &state);
- stateString = psCommand_stateString(state);
- bundle_getCurrentModule(bundle, &module);
- module_getSymbolicName(module, &name);
- if (showLocation) {
- bundleArchive_getLocation(archive, &name);
- } else if (showSymbolicName) {
- // do nothing
- } else if (showUpdateLocation) {
- bundleArchive_getLocation(archive, &name);
- }
-
- sprintf(line, " %-5ld %-12s %s\n", id, stateString, name);
- out(line);
- }
- arrayList_destroy(bundles);
- }
+static char * psCommand_stateString(bundle_state_e state);
+
+celix_status_t psCommand_execute(void *handle, char * commandline, FILE *outStream, FILE *errStream) {
+ celix_status_t status = CELIX_SUCCESS;
+ array_list_pt bundles = NULL;
+ bundle_context_pt context = handle;
+
+ status = bundleContext_getBundles(context, &bundles);
+
+ bool showLocation = false;
+ bool showSymbolicName = false;
+ bool showUpdateLocation = false;
+ char * msg = "Name";
+ unsigned int i;
+
+ char delims[] = " ";
+ char * sub = NULL;
+ char *save_ptr = NULL;
+ sub = strtok_r(commandline, delims, &save_ptr);
+ sub = strtok_r(NULL, delims, &save_ptr);
+ while (sub != NULL) {
+ if (strcmp(sub, "-l") == 0) {
+ showLocation = true;
+ msg = "Location";
+ } else if (strcmp(sub, "-s") == 0) {
+ showSymbolicName = true;
+ msg = "Symbolic name";
+ } else if (strcmp(sub, "-u") == 0) {
+ showUpdateLocation = true;
+ msg = "Update location";
+ }
+ sub = strtok_r(NULL, delims, &save_ptr);
+ }
+
+ fprintf(outStream, " %-5s %-12s %s\n", "ID", "State", msg);
+
+ unsigned int size = arrayList_size(bundles);
+ bundle_pt bundlesA[size];
+ for (i = 0; i < size; i++) {
+ bundlesA[i] = arrayList_get(bundles, i);
+ }
+
+ int j;
+ for(i=0; i < size - 1; i++) {
+ for(j=i+1; j < size; j++) {
+ bundle_pt first = bundlesA[i];
+ bundle_pt second = bundlesA[j];
+
+ bundle_archive_pt farchive = NULL, sarchive = NULL;
+ long fid, sid;
+
+ bundle_getArchive(first, &farchive);
+ bundleArchive_getId(farchive, &fid);
+ bundle_getArchive(second, &sarchive);
+ bundleArchive_getId(sarchive, &sid);
+
+ if(fid > sid)
+ {
+ // these three lines swap the elements bundles[i] and bundles[j].
+ bundle_pt temp = bundlesA[i];
+ bundlesA[i] = bundlesA[j];
+ bundlesA[j] = temp;
+ }
+ }
+ }
+ for (i = 0; i < size; i++) {
+ //bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i);
+ bundle_pt bundle = bundlesA[i];
+ bundle_archive_pt archive = NULL;
+ long id;
+ bundle_state_e state;
+ char * stateString = NULL;
+ module_pt module = NULL;
+ char * name = NULL;
+
+ bundle_getArchive(bundle, &archive);
+ bundleArchive_getId(archive, &id);
+ bundle_getState(bundle, &state);
+ stateString = psCommand_stateString(state);
+ bundle_getCurrentModule(bundle, &module);
+ module_getSymbolicName(module, &name);
+ if (showLocation) {
+ bundleArchive_getLocation(archive, &name);
+ } else if (showSymbolicName) {
+ // do nothing
+ } else if (showUpdateLocation) {
+ bundleArchive_getLocation(archive, &name);
+ }
+
+ fprintf(outStream, " %-5ld %-12s %s\n", id, stateString, name);
+ }
+ arrayList_destroy(bundles);
+ return status;
}
-char * psCommand_stateString(bundle_state_e state) {
+static char * psCommand_stateString(bundle_state_e state) {
switch (state) {
case OSGI_FRAMEWORK_BUNDLE_ACTIVE:
return "Active ";
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/private/src/shell.c
----------------------------------------------------------------------
diff --git a/shell/private/src/shell.c b/shell/private/src/shell.c
index 18ee201..4b3e494 100644
--- a/shell/private/src/shell.c
+++ b/shell/private/src/shell.c
@@ -30,21 +30,10 @@
#include "shell_private.h"
#include "bundle_activator.h"
-#include "command_impl.h"
#include "bundle_context.h"
#include "service_registration.h"
#include "service_listener.h"
-#include "ps_command.h"
-#include "start_command.h"
-#include "stop_command.h"
-#include "install_command.h"
-#include "uninstall_command.h"
-#include "update_command.h"
-#include "log_command.h"
-#include "inspect_command.h"
-#include "help_command.h"
-
#include "utils.h"
static command_service_pt shell_getCommand(shell_pt shell, char * commandName);
@@ -65,7 +54,6 @@ celix_status_t shell_create(bundle_context_pt context, shell_service_pt* shellSe
lclService->getCommands = shell_getCommands;
lclService->getCommandDescription = shell_getCommandDescription;
lclService->getCommandUsage = shell_getCommandUsage;
- lclService->getCommandReference = shell_getCommandReference;
lclService->executeCommand = shell_executeCommand;
*shellService = lclService;
@@ -92,10 +80,18 @@ celix_status_t shell_addCommand(shell_pt shell, service_reference_pt reference)
command_service_pt command = NULL;
void *cmd = NULL;
+ char *name = NULL;
bundleContext_getService(shell->bundleContext, reference, &cmd);
+ serviceReference_getProperty(reference, "command.name", &name);
command = (command_service_pt) cmd;
- hashMap_put(shell->commandNameMap, command->getName(command->command), command);
- hashMap_put(shell->commandReferenceMap, reference, command);
+ if (name != NULL) {
+ hashMap_put(shell->commandNameMap, name, command);
+ hashMap_put(shell->commandReferenceMap, reference, command);
+ } else {
+ status = CELIX_ILLEGAL_ARGUMENT;
+ fprintf(stderr, "TODO\n");
+ //TODO log to log service
+ }
return status;
}
@@ -104,11 +100,13 @@ celix_status_t shell_removeCommand(shell_pt shell, service_reference_pt referenc
celix_status_t status = CELIX_SUCCESS;
command_service_pt command = (command_service_pt) hashMap_remove(shell->commandReferenceMap, reference);
- if (command != NULL) {
+ char *name = NULL;
+ serviceReference_getProperty(reference, "command.name", &name);
+ if (command != NULL && name != NULL) {
bool result = false;
- hashMap_remove(shell->commandNameMap, command->getName(command->command));
+ hashMap_remove(shell->commandNameMap, name);
bundleContext_ungetService(shell->bundleContext, reference, &result);
- }
+ }
return status;
}
@@ -127,26 +125,21 @@ array_list_pt shell_getCommands(shell_pt shell) {
}
char * shell_getCommandUsage(shell_pt shell, char * commandName) {
- command_service_pt command = hashMap_get(shell->commandNameMap, commandName);
- return (command == NULL) ? NULL : command->getUsage(command->command);
+ //command_service_pt command = hashMap_get(shell->commandNameMap, commandName);
+ // char *usage = NULL;
+ // bundleContext_getProperty(shell->bundleContext, "command.usage", &usage);
+ //return (command == NULL || usage == NULL) ? NULL : usage;
+ return "TODO";
}
char * shell_getCommandDescription(shell_pt shell, char * commandName) {
+ /*
command_service_pt command = hashMap_get(shell->commandNameMap, commandName);
- return (command == NULL) ? NULL : command->getShortDescription(command->command);
-}
-
-service_reference_pt shell_getCommandReference(shell_pt shell, char * command) {
- hash_map_iterator_pt iter = hashMapIterator_create(shell->commandReferenceMap);
- while (hashMapIterator_hasNext(iter)) {
- hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
- command_service_pt cmd = (command_service_pt) hashMapEntry_getValue(entry);
- if (strcmp(cmd->getName(cmd->command), command) == 0) {
- return (service_reference_pt) hashMapEntry_getValue(entry);
- }
- }
- hashMapIterator_destroy(iter);
- return NULL;
+ char *desc = NULL;
+ bundleContext_getProperty(shell->bundleContext, "command.description", &desc);
+ return (command == NULL || desc == NULL) ? NULL : desc;
+ */
+ return "TODO";
}
void shell_executeCommand(shell_pt shell, char * commandLine, void (*out)(char *), void (*error)(char *)) {
@@ -154,7 +147,10 @@ void shell_executeCommand(shell_pt shell, char * commandLine, void (*out)(char *
char * commandName = (pos != strlen(commandLine)) ? string_ndup((char *) commandLine, pos) : strdup(commandLine);
command_service_pt command = shell_getCommand(shell, commandName);
if (command != NULL) {
- command->executeCommand(command->command, commandLine, out, error);
+ printf("TODO\n");
+ //FIXME udpate shell_executeCommand with FILE
+ //command->executeCommand(command->command, commandLine, out, error);
+ command->executeCommand(command->handle, commandLine, stdout, stderr);
} else {
error("No such command\n");
}
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/public/include/command.h
----------------------------------------------------------------------
diff --git a/shell/public/include/command.h b/shell/public/include/command.h
index 81fcd3d..710bf9d 100644
--- a/shell/public/include/command.h
+++ b/shell/public/include/command.h
@@ -27,18 +27,15 @@
#ifndef COMMAND_H_
#define COMMAND_H_
-static const char * const OSGI_SHELL_COMMAND_SERVICE_NAME = "commandService";
+#include "celix_errno.h"
-typedef struct command * command_pt;
+static const char * const OSGI_SHELL_COMMAND_SERVICE_NAME = "commandService";
typedef struct commandService * command_service_pt;
struct commandService {
- command_pt command;
- char * (*getName)(command_pt command);
- char * (*getUsage)(command_pt command);
- char * (*getShortDescription)(command_pt command);
- void (*executeCommand)(command_pt command, char * commandLine, void (*out)(char *), void (*error)(char *));
+ void *handle;
+ celix_status_t (*executeCommand)(void *handle, char * commandLine, FILE *outStream, FILE *errorStream);
};
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/public/include/command_impl.h
----------------------------------------------------------------------
diff --git a/shell/public/include/command_impl.h b/shell/public/include/command_impl.h
deleted file mode 100644
index ae33738..0000000
--- a/shell/public/include/command_impl.h
+++ /dev/null
@@ -1,48 +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.
- */
-/*
- * command_impl.h
- *
- * \date Aug 13, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef COMMAND_PRIVATE_H_
-#define COMMAND_PRIVATE_H_
-
-#include "command.h"
-#include "bundle_context.h"
-
-struct command {
- char * name;
- char * usage;
- char * shortDescription;
-
- bundle_context_pt bundleContext;
- void *handle;
-
- void (*executeCommand)(command_pt command, char * commandLine, void (*out)(char *), void (*error)(char *));
-};
-
-char *command_getName(command_pt command);
-char *command_getUsage(command_pt command);
-char *command_getShortDescription(command_pt command);
-
-#endif /* COMMAND_PRIVATE_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/public/include/shell.h
----------------------------------------------------------------------
diff --git a/shell/public/include/shell.h b/shell/public/include/shell.h
index 25706c7..11a79b3 100644
--- a/shell/public/include/shell.h
+++ b/shell/public/include/shell.h
@@ -39,7 +39,6 @@ struct shellService {
array_list_pt (*getCommands)(shell_pt shell);
char * (*getCommandUsage)(shell_pt shell, char * commandName);
char * (*getCommandDescription)(shell_pt shell, char * commandName);
- service_reference_pt (*getCommandReference)(shell_pt shell, char * command);
void (*executeCommand)(shell_pt shell, char * commandLine, void (*out)(char *), void (*error)(char *));
};
http://git-wip-us.apache.org/repos/asf/celix/blob/cea3f9ec/shell/public/src/command.c
----------------------------------------------------------------------
diff --git a/shell/public/src/command.c b/shell/public/src/command.c
deleted file mode 100644
index 955fbe4..0000000
--- a/shell/public/src/command.c
+++ /dev/null
@@ -1,45 +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.
- */
-/*
- * command.c
- *
- * \date Aug 13, 2010
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#include <stdio.h>
-
-#include "command_impl.h"
-
-char * command_getName(command_pt command) {
- return command->name;
-}
-
-char * command_getUsage(command_pt command) {
- return command->usage;
-}
-
-char * command_getShortDescription(command_pt command) {
- return command->shortDescription;
-}
-
-void command_execute(command_pt command, char * line, void (*out)(char *), void (*err)(char *)) {
- command->executeCommand(command, line, out, err);
-}