You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2013/04/26 20:54:29 UTC

git commit: updated refs/heads/4.1 to 457e859

Updated Branches:
  refs/heads/4.1 2aeb46072 -> 457e85922


CLOUDSTACK-2194: Defer ApiDiscoveryServiceImpl load after db upgrade

Signed-off-by: Chip Childers <ch...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/457e8592
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/457e8592
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/457e8592

Branch: refs/heads/4.1
Commit: 457e85922b3f9170186422d2500bfd9f35560ca7
Parents: 2aeb460
Author: Edison Su <ed...@citrix.com>
Authored: Fri Apr 26 19:52:56 2013 +0100
Committer: Chip Childers <ch...@gmail.com>
Committed: Fri Apr 26 19:52:56 2013 +0100

----------------------------------------------------------------------
 .../discovery/ApiDiscoveryServiceImpl.java         |   11 ++++++++---
 .../cloudstack/discovery/ApiDiscoveryTest.java     |    2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/457e8592/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
index b371488..89eb340 100755
--- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import javax.annotation.PostConstruct;
 import javax.ejb.Local;
 import javax.inject.Inject;
+import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.acl.APIChecker;
 import org.apache.cloudstack.api.APICommand;
@@ -47,12 +48,13 @@ import com.cloud.serializer.Param;
 import com.cloud.user.User;
 import com.cloud.utils.ReflectUtil;
 import com.cloud.utils.StringUtils;
+import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.component.PluggableService;
 import com.google.gson.annotations.SerializedName;
 
 @Component
 @Local(value = ApiDiscoveryService.class)
-public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
+public class ApiDiscoveryServiceImpl extends ManagerBase implements ApiDiscoveryService {
     private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class);
 
     @Inject protected List<APIChecker> _apiAccessCheckers = null;
@@ -63,8 +65,9 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
         super();
     }
 
-    @PostConstruct
-    void init() {
+    @Override
+	public boolean configure(String name, Map<String, Object> params)
+			throws ConfigurationException {
         if (s_apiNameDiscoveryResponseMap == null) {
             long startTime = System.nanoTime();
             s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
@@ -78,6 +81,8 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
             long endTime = System.nanoTime();
             s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");
         }
+        
+        return true;
     }
 
     protected void cacheResponseMap(Set<Class<?>> cmdClasses) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/457e8592/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java b/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
index afff746..fa6000c 100644
--- a/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
+++ b/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
@@ -65,7 +65,7 @@ public class ApiDiscoveryTest {
 
         Set<Class<?>> cmdClasses = new HashSet<Class<?>>();
         cmdClasses.add(ListApisCmd.class);
-        _discoveryService.init();
+        _discoveryService.configure(null, null);
         _discoveryService.cacheResponseMap(cmdClasses);
     }