ApiServer: Fix apidiscovery fail case, fix comment

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2013-01-09 04:15:19 -08:00
parent ef89793c4e
commit 765504c070
1 changed files with 6 additions and 4 deletions

View File

@ -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) {