incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [5/43] git commit: Initialize user context from AccountManager
Date Wed, 08 Aug 2012 18:55:23 GMT
Initialize user context from AccountManager

Conflicts:

	server/src/com/cloud/configuration/DefaultComponentLibrary.java
	server/src/com/cloud/network/vpc/VpcManagerImpl.java


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

Branch: refs/heads/vpc
Commit: da26302049f48839dc364eefd32cd5597ac05bdc
Parents: 9e1b8ca
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Wed Aug 8 11:13:30 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Wed Aug 8 11:17:01 2012 -0700

----------------------------------------------------------------------
 api/src/com/cloud/user/UserContext.java           |   15 ++++++++-------
 server/src/com/cloud/user/AccountManagerImpl.java |    3 +++
 2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/da263020/api/src/com/cloud/user/UserContext.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/user/UserContext.java b/api/src/com/cloud/user/UserContext.java
index b140728..ed33e88 100644
--- a/api/src/com/cloud/user/UserContext.java
+++ b/api/src/com/cloud/user/UserContext.java
@@ -16,14 +16,11 @@
 // under the License.
 package com.cloud.user;
 
-import com.cloud.server.ManagementService;
-import com.cloud.utils.component.ComponentLocator;
 
 public class UserContext {
 
     private static ThreadLocal<UserContext> s_currentContext = new ThreadLocal<UserContext>();
-    private static final ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
-    private static final AccountService _accountMgr = locator.getManager(AccountService.class);
+    private static UserContext s_adminContext = null;
 
     private long userId;
     private String sessionId;
@@ -33,9 +30,7 @@ public class UserContext {
     private String eventDetails;
 
     private boolean apiServer;
-
-    private static UserContext s_adminContext = new UserContext(_accountMgr.getSystemUser().getId(),
_accountMgr.getSystemAccount(), null, false);
-
+    
     public UserContext() {
     }
 
@@ -134,4 +129,10 @@ public class UserContext {
     public String getEventDetails() {
         return eventDetails;
     }
+
+    public static synchronized void setAdminContext(UserContext adminContext) {
+        if (adminContext == null) {
+            UserContext.s_adminContext = adminContext;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/da263020/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index 0a11dc4..1631482 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -239,6 +239,9 @@ public class AccountManagerImpl implements AccountManager, AccountService,
Manag
         if (_userAuthenticators == null || !_userAuthenticators.isSet()) {
             s_logger.error("Unable to find an user authenticator.");
         }
+        
+        //initialize admin context
+        UserContext.setAdminContext(new UserContext(getSystemUser().getId(), getSystemAccount(),
null, false));
 
         return true;
     }


Mime
View raw message