You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/01/09 14:26:47 UTC
[38/50] [abbrv] git commit: ApiServer: Fix apidiscovery fail case,
fix comment
ApiServer: Fix apidiscovery fail case, fix comment
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/765504c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/765504c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/765504c0
Branch: refs/heads/javelin
Commit: 765504c070919cd8e6ee53e23985a37c9a7ecdf6
Parents: ef89793
Author: Rohit Yadav <bh...@apache.org>
Authored: Wed Jan 9 04:15:19 2013 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Wed Jan 9 04:18:35 2013 -0800
----------------------------------------------------------------------
server/src/com/cloud/api/ApiServer.java | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/765504c0/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 8d304e0..56cef12 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -168,9 +168,7 @@ public class ApiServer implements HttpRequestHandler {
public static void initApiServer(String[] apiConfig) {
if (s_instance == null) {
- //Injecting will create ApiServer object with all its
- //vars injected as well, no need to do the following:
- //s_instance = new ApiServer();
+ //Injection will create ApiServer and all its fields which have @Inject
s_instance = ComponentLocator.inject(ApiServer.class);
s_instance.init(apiConfig);
}
@@ -178,7 +176,6 @@ public class ApiServer implements HttpRequestHandler {
public static ApiServer getInstance() {
// Assumption: CloudStartupServlet would initialize ApiServer
- // initApiServer(null);
if (s_instance == null) {
s_logger.fatal("ApiServer instance failed to initialize");
}
@@ -210,6 +207,11 @@ public class ApiServer implements HttpRequestHandler {
_apiNameCmdClassMap.putAll(discoveryService.getApiNameCmdClassMapping());
}
+ if (_apiNameCmdClassMap.size() == 0) {
+ s_logger.fatal("ApiServer failed to generate apiname, cmd class mappings."
+ + "Please check and enable at least one ApiDiscovery adapter.");
+ }
+
encodeApiResponse = Boolean.valueOf(configDao.getValue(Config.EncodeApiResponse.key()));
String jsonType = configDao.getValue(Config.JavaScriptDefaultContentType.key());
if (jsonType != null) {