You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2013/09/30 18:53:28 UTC
[1/6] git commit: updated refs/heads/master to cba8e40
Updated Branches:
refs/heads/master 2e29c89b8 -> cba8e40e4
Add Named interface to recognize objects with a getName()
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9a083b9e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9a083b9e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9a083b9e
Branch: refs/heads/master
Commit: 9a083b9e66c15bd5b6d4a79e6952e3b6d778950b
Parents: 2e29c89
Author: Darren Shepherd <da...@gmail.com>
Authored: Mon Sep 30 09:23:23 2013 -0700
Committer: Darren Shepherd <da...@gmail.com>
Committed: Mon Sep 30 09:23:23 2013 -0700
----------------------------------------------------------------------
.../utils/component/ComponentLifecycle.java | 4 ++--
utils/src/com/cloud/utils/component/Named.java | 25 ++++++++++++++++++++
2 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a083b9e/utils/src/com/cloud/utils/component/ComponentLifecycle.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/ComponentLifecycle.java b/utils/src/com/cloud/utils/component/ComponentLifecycle.java
index ea671af..aac4eb0 100644
--- a/utils/src/com/cloud/utils/component/ComponentLifecycle.java
+++ b/utils/src/com/cloud/utils/component/ComponentLifecycle.java
@@ -20,7 +20,7 @@ import java.util.Map;
import javax.naming.ConfigurationException;
-public interface ComponentLifecycle {
+public interface ComponentLifecycle extends Named {
public static final int RUN_LEVEL_SYSTEM_BOOTSTRAP = 0; // for system level bootstrap components
public static final int RUN_LEVEL_SYSTEM = 1; // for system level service components (i.e., DAOs)
public static final int RUN_LEVEL_FRAMEWORK_BOOTSTRAP = 2; // for framework startup checkers (i.e., DB migration check)
@@ -30,7 +30,7 @@ public interface ComponentLifecycle {
public static final int RUN_LEVEL_APPLICATION_MAINLOOP = 6;
public static final int MAX_RUN_LEVELS = 7;
-
+ @Override
String getName();
void setName(String name);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a083b9e/utils/src/com/cloud/utils/component/Named.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/Named.java b/utils/src/com/cloud/utils/component/Named.java
new file mode 100644
index 0000000..6960b4c
--- /dev/null
+++ b/utils/src/com/cloud/utils/component/Named.java
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+package com.cloud.utils.component;
+
+public interface Named {
+
+ String getName();
+
+}
[4/6] git commit: updated refs/heads/master to cba8e40
Posted by da...@apache.org.
Cleanup DefaultUserAuthenticator and removed masking _name variable
DefaultUserAuthenticator maskes the _name varible in ComponentLifecycleBase
making the setName() method not work as expected. This patch cleans up the
code such that getName() will be getClass().getSimpleName() unless
overridden in the Spring configuration.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/692535f9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/692535f9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/692535f9
Branch: refs/heads/master
Commit: 692535f92847fb6e4b2d349b55137cb7025567dd
Parents: 766a0a2
Author: Darren Shepherd <da...@gmail.com>
Authored: Mon Sep 30 09:33:33 2013 -0700
Committer: Darren Shepherd <da...@gmail.com>
Committed: Mon Sep 30 09:33:33 2013 -0700
----------------------------------------------------------------------
.../cloudstack/ldap/LdapAuthenticator.java | 10 --------
.../cloud/server/auth/MD5UserAuthenticator.java | 14 +---------
.../server/auth/PlainTextUserAuthenticator.java | 15 -----------
.../auth/SHA256SaltedUserAuthenticator.java | 11 --------
.../server/auth/DefaultUserAuthenticator.java | 27 --------------------
5 files changed, 1 insertion(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/692535f9/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
index e62a3d8..559a979 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapAuthenticator.java
@@ -19,7 +19,6 @@ package org.apache.cloudstack.ldap;
import java.util.Map;
import javax.inject.Inject;
-import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
@@ -48,15 +47,6 @@ public class LdapAuthenticator extends DefaultUserAuthenticator {
}
@Override
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- if (name == null) {
- name = "LDAP";
- }
- super.configure(name, params);
- return true;
- }
-
- @Override
public boolean authenticate(final String username, final String password,
final Long domainId, final Map<String, Object[]> requestParameters) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/692535f9/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java b/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java
index e5b169f..63583af 100644
--- a/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java
+++ b/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java
@@ -22,12 +22,11 @@ import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
-import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
+
import com.cloud.user.UserAccount;
import com.cloud.user.dao.UserAccountDao;
-
import com.cloud.utils.exception.CloudRuntimeException;
/**
@@ -59,17 +58,6 @@ public class MD5UserAuthenticator extends DefaultUserAuthenticator {
return true;
}
- @Override
- public boolean configure(String name, Map<String, Object> params)
- throws ConfigurationException {
- if(name == null) {
- name = "MD5";
- }
- super.configure(name, params);
- return true;
- }
-
- @Override
public String encode(String password) {
MessageDigest md5 = null;
try {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/692535f9/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java b/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java
index f102275..849e82e 100644
--- a/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java
+++ b/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java
@@ -15,20 +15,15 @@
package com.cloud.server.auth;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
-import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.user.UserAccount;
import com.cloud.user.dao.UserAccountDao;
-import com.cloud.utils.exception.CloudRuntimeException;
@Local(value={UserAuthenticator.class})
@@ -56,16 +51,6 @@ public class PlainTextUserAuthenticator extends DefaultUserAuthenticator {
return true;
}
- @Override
- public boolean configure(String name, Map<String, Object> params)
- throws ConfigurationException {
- if (name == null) {
- name = "PLAINTEXT";
- }
- super.configure(name, params);
- return true;
- }
-
@Override
public String encode(String password) {
// Plaintext so no encoding at all
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/692535f9/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java b/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java
index 91be922..3592ddc 100644
--- a/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java
+++ b/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java
@@ -24,7 +24,6 @@ import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
-import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.bouncycastle.util.encoders.Base64;
@@ -42,16 +41,6 @@ public class SHA256SaltedUserAuthenticator extends DefaultUserAuthenticator {
private UserAccountDao _userAccountDao;
private static final int s_saltlen = 32;
- @Override
- public boolean configure(String name, Map<String, Object> params)
- throws ConfigurationException {
- if (name == null) {
- name = "SHA256SALT";
- }
- super.configure(name, params);
- return true;
- }
-
/* (non-Javadoc)
* @see com.cloud.server.auth.UserAuthenticator#authenticate(java.lang.String, java.lang.String, java.lang.Long, java.util.Map)
*/
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/692535f9/server/src/com/cloud/server/auth/DefaultUserAuthenticator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/auth/DefaultUserAuthenticator.java b/server/src/com/cloud/server/auth/DefaultUserAuthenticator.java
index 952f724..253b0ac 100644
--- a/server/src/com/cloud/server/auth/DefaultUserAuthenticator.java
+++ b/server/src/com/cloud/server/auth/DefaultUserAuthenticator.java
@@ -16,10 +16,7 @@
// under the License.
package com.cloud.server.auth;
-import java.util.Map;
-
import javax.ejb.Local;
-import javax.naming.ConfigurationException;
import com.cloud.utils.component.AdapterBase;
@@ -29,28 +26,4 @@ import com.cloud.utils.component.AdapterBase;
*/
@Local(value={UserAuthenticator.class})
public abstract class DefaultUserAuthenticator extends AdapterBase implements UserAuthenticator {
- private String _name = null;
-
- @Override
- public boolean configure(String name, Map<String, Object> params)
- throws ConfigurationException {
- _name = name;
- return true;
- }
-
- @Override
- public String getName() {
- return _name;
- }
-
- @Override
- public boolean start() {
- return true;
- }
-
- @Override
- public boolean stop() {
- return true;
- }
-
}
[5/6] git commit: updated refs/heads/master to cba8e40
Posted by da...@apache.org.
Switch to setter injection for extensibility
Various classes are using member injection to inject extensible objects.
Really those object should come from an AdapterList that is injected in.
This patch switches the code to use setter injection that will later allow
spring to inject an AdapterList or something similar to allow
extensibility.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/efbfae72
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/efbfae72
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/efbfae72
Branch: refs/heads/master
Commit: efbfae723ec5583378cb90c54fc63b6975c7fc24
Parents: 692535f
Author: Darren Shepherd <da...@gmail.com>
Authored: Mon Sep 30 09:45:07 2013 -0700
Committer: Darren Shepherd <da...@gmail.com>
Committed: Mon Sep 30 09:45:07 2013 -0700
----------------------------------------------------------------------
.../com/cloud/vm/VirtualMachineManagerImpl.java | 10 ++++++-
.../cloud/entity/api/VMEntityManagerImpl.java | 10 ++++++-
.../acl/StaticRoleBasedAPIAccessChecker.java | 11 ++++++-
server/src/com/cloud/api/ApiServer.java | 22 ++++++++++++--
.../configuration/ConfigurationManagerImpl.java | 10 ++++++-
.../consoleproxy/ConsoleProxyManagerImpl.java | 10 ++++++-
.../hypervisor/HypervisorGuruManagerImpl.java | 30 ++++++++++++++++++--
.../com/cloud/network/NetworkServiceImpl.java | 11 ++++++-
.../com/cloud/server/ManagementServerImpl.java | 10 ++++++-
.../com/cloud/storage/VolumeApiServiceImpl.java | 10 ++++++-
.../secondary/SecondaryStorageManagerImpl.java | 10 ++++++-
.../com/cloud/template/TemplateManagerImpl.java | 10 ++++++-
12 files changed, 139 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index af6ca6d..560bab2 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -257,7 +257,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
this._hostAllocators = _hostAllocators;
}
- @Inject
protected List<StoragePoolAllocator> _storagePoolAllocators;
@Inject
@@ -3271,4 +3270,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
VmOpWaitInterval};
}
+ public List<StoragePoolAllocator> getStoragePoolAllocators() {
+ return _storagePoolAllocators;
+ }
+
+ @Inject
+ public void setStoragePoolAllocators(List<StoragePoolAllocator> storagePoolAllocators) {
+ this._storagePoolAllocators = storagePoolAllocators;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index 204b832..e784295 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -99,7 +99,6 @@ public class VMEntityManagerImpl implements VMEntityManager {
@Inject
protected VirtualMachineManager _itMgr;
- @Inject
protected List<DeploymentPlanner> _planners;
@Inject
@@ -257,4 +256,13 @@ public class VMEntityManagerImpl implements VMEntityManager {
return true;
}
+ public List<DeploymentPlanner> getPlanners() {
+ return _planners;
+ }
+
+ @Inject
+ public void setPlanners(List<DeploymentPlanner> planners) {
+ this._planners = planners;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
----------------------------------------------------------------------
diff --git a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
index d4d73d1..affcf91 100644
--- a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
+++ b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
@@ -46,7 +46,7 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
private static Map<RoleType, Set<String>> s_roleBasedApisMap =
new HashMap<RoleType, Set<String>>();
- @Inject List<PluggableService> _services;
+ List<PluggableService> _services;
@Inject AccountService _accountService;
protected StaticRoleBasedAPIAccessChecker() {
@@ -95,4 +95,13 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC
}
}
}
+
+ public List<PluggableService> getServices() {
+ return _services;
+ }
+
+ @Inject
+ public void setServices(List<PluggableService> _services) {
+ this._services = _services;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/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 550626f..26789e3 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -169,8 +169,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
@Inject
private EntityManager _entityMgr;
- @Inject List<PluggableService> _pluggableServices;
- @Inject List<APIChecker> _apiAccessCheckers;
+ List<PluggableService> _pluggableServices;
+ List<APIChecker> _apiAccessCheckers;
@Inject
protected ApiAsyncJobDispatcher _asyncDispatcher;
@@ -1096,4 +1096,22 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
}
return responseText;
}
+
+ public List<PluggableService> getPluggableServices() {
+ return _pluggableServices;
+ }
+
+ @Inject
+ public void setPluggableServices(List<PluggableService> _pluggableServices) {
+ this._pluggableServices = _pluggableServices;
+ }
+
+ public List<APIChecker> getApiAccessCheckers() {
+ return _apiAccessCheckers;
+ }
+
+ @Inject
+ public void setApiAccessCheckers(List<APIChecker> _apiAccessCheckers) {
+ this._apiAccessCheckers = _apiAccessCheckers;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 8a0f7a6..2b86bf5 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -250,7 +250,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
@Inject
AlertManager _alertMgr;
// @com.cloud.utils.component.Inject(adapter = SecurityChecker.class)
- @Inject
List<SecurityChecker> _secChecker;
@Inject
@@ -4934,5 +4933,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
return false;
}
+ public List<SecurityChecker> getSecChecker() {
+ return _secChecker;
+ }
+
+ @Inject
+ public void setSecChecker(List<SecurityChecker> secChecker) {
+ this._secChecker = secChecker;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index d51eb41..030a31f 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -166,7 +166,6 @@ VirtualMachineGuru, SystemVmLoadScanHandler<Long>, ResourceStateAdapter {
private int _mgmt_port = 8250;
- @Inject
private List<ConsoleProxyAllocator> _consoleProxyAllocators;
@Inject
@@ -1702,4 +1701,13 @@ VirtualMachineGuru, SystemVmLoadScanHandler<Long>, ResourceStateAdapter {
public void prepareStop(VirtualMachineProfile profile) {
}
+ public List<ConsoleProxyAllocator> getConsoleProxyAllocators() {
+ return _consoleProxyAllocators;
+ }
+
+ @Inject
+ public void setConsoleProxyAllocators(List<ConsoleProxyAllocator> consoleProxyAllocators) {
+ this._consoleProxyAllocators = consoleProxyAllocators;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/hypervisor/HypervisorGuruManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruManagerImpl.java b/server/src/com/cloud/hypervisor/HypervisorGuruManagerImpl.java
index 4d1e1b5..d0effab 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruManagerImpl.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruManagerImpl.java
@@ -19,6 +19,7 @@ package com.cloud.hypervisor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.PostConstruct;
import javax.ejb.Local;
@@ -26,6 +27,7 @@ import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.utils.Pair;
+
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -43,8 +45,8 @@ public class HypervisorGuruManagerImpl extends ManagerBase implements Hypervisor
@Inject HostDao _hostDao;
- @Inject List<HypervisorGuru> _hvGuruList;
- Map<HypervisorType, HypervisorGuru> _hvGurus = new HashMap<HypervisorType, HypervisorGuru>();
+ List<HypervisorGuru> _hvGuruList;
+ Map<HypervisorType, HypervisorGuru> _hvGurus = new ConcurrentHashMap<HypervisorType, HypervisorGuru>();
@PostConstruct
public void init() {
@@ -55,7 +57,19 @@ public class HypervisorGuruManagerImpl extends ManagerBase implements Hypervisor
@Override
public HypervisorGuru getGuru(HypervisorType hypervisorType) {
- return _hvGurus.get(hypervisorType);
+ HypervisorGuru result = _hvGurus.get(hypervisorType);
+
+ if ( result == null ) {
+ for ( HypervisorGuru guru : _hvGuruList ) {
+ if ( guru.getHypervisorType() == hypervisorType ) {
+ _hvGurus.put(hypervisorType, guru);
+ result = guru;
+ break;
+ }
+ }
+ }
+
+ return result;
}
@Override
@@ -68,4 +82,14 @@ public class HypervisorGuruManagerImpl extends ManagerBase implements Hypervisor
}
return hostId;
}
+
+ public List<HypervisorGuru> getHvGuruList() {
+ return _hvGuruList;
+ }
+
+ @Inject
+ public void setHvGuruList(List<HypervisorGuru> hvGuruList) {
+ this._hvGuruList = hvGuruList;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 598b31c..61c070a 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -230,7 +230,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
@Inject
UsageEventDao _usageEventDao;
- @Inject List<NetworkGuru> _networkGurus;
+ List<NetworkGuru> _networkGurus;
@Inject
NetworkDomainDao _networkDomainDao;
@@ -3944,4 +3944,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return _networkMgr.listVmNics(vmId, nicId);
}
+ public List<NetworkGuru> getNetworkGurus() {
+ return _networkGurus;
+ }
+
+ @Inject
+ public void setNetworkGurus(List<NetworkGuru> networkGurus) {
+ this._networkGurus = networkGurus;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index c0a52f7..1c31610 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -675,7 +675,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Inject
private HypervisorCapabilitiesDao _hypervisorCapabilitiesDao;
private List<HostAllocator> _hostAllocators;
- @Inject
private List<StoragePoolAllocator> _storagePoolAllocators;
@Inject
private ResourceTagDao _resourceTagDao;
@@ -3870,4 +3869,13 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
_dpMgr.cleanupVMReservations();
}
+
+ public List<StoragePoolAllocator> getStoragePoolAllocators() {
+ return _storagePoolAllocators;
+ }
+
+ @Inject
+ public void setStoragePoolAllocators(List<StoragePoolAllocator> storagePoolAllocators) {
+ this._storagePoolAllocators = storagePoolAllocators;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index b573786..faff10f 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -273,7 +273,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
protected VmDiskStatisticsDao _vmDiskStatsDao;
@Inject
protected VMSnapshotDao _vmSnapshotDao;
- @Inject
protected List<StoragePoolAllocator> _storagePoolAllocators;
@Inject
ConfigurationDao _configDao;
@@ -1693,4 +1692,13 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
return true;
}
+ public List<StoragePoolAllocator> getStoragePoolAllocators() {
+ return _storagePoolAllocators;
+ }
+
+ @Inject
+ public void setStoragePoolAllocators(List<StoragePoolAllocator> storagePoolAllocators) {
+ this._storagePoolAllocators = storagePoolAllocators;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index 3a07034..007557d 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -169,7 +169,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
private int _mgmt_port = 8250;
- @Inject
private List<SecondaryStorageVmAllocator> _ssVmAllocators;
@Inject
@@ -1374,4 +1373,13 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
public void prepareStop(VirtualMachineProfile profile) {
}
+
+ public List<SecondaryStorageVmAllocator> getSecondaryStorageVmAllocators() {
+ return _ssVmAllocators;
+ }
+
+ @Inject
+ public void setSecondaryStorageVmAllocators(List<SecondaryStorageVmAllocator> ssVmAllocators) {
+ this._ssVmAllocators = ssVmAllocators;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/efbfae72/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index 9fa2e8b..5240102 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -291,7 +291,6 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
boolean _disableExtraction = false;
ExecutorService _preloadExecutor;
- @Inject
protected List<TemplateAdapter> _adapters;
@Inject
@@ -1823,4 +1822,13 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {AllowPublicUserTemplates};
}
+
+ public List<TemplateAdapter> getTemplateAdapters() {
+ return _adapters;
+ }
+
+ @Inject
+ public void setTemplateAdapters(List<TemplateAdapter> adapters) {
+ this._adapters = adapters;
+ }
}
[6/6] git commit: updated refs/heads/master to cba8e40
Posted by da...@apache.org.
Add license headers to fix build
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cba8e40e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cba8e40e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cba8e40e
Branch: refs/heads/master
Commit: cba8e40e4bb060f2768d3b3a364d33f27c50891e
Parents: efbfae7
Author: Darren Shepherd <da...@gmail.com>
Authored: Mon Sep 30 09:51:45 2013 -0700
Committer: Darren Shepherd <da...@gmail.com>
Committed: Mon Sep 30 09:51:45 2013 -0700
----------------------------------------------------------------------
server/test/com/cloud/api/ApiDispatcherTest.java | 18 ++++++++++++++++++
.../com/cloud/utils/encoding/UrlEncoderTest.java | 18 ++++++++++++++++++
2 files changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cba8e40e/server/test/com/cloud/api/ApiDispatcherTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/api/ApiDispatcherTest.java b/server/test/com/cloud/api/ApiDispatcherTest.java
index 9d54aaa..4fca289 100644
--- a/server/test/com/cloud/api/ApiDispatcherTest.java
+++ b/server/test/com/cloud/api/ApiDispatcherTest.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package com.cloud.api;
import java.util.HashMap;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cba8e40e/utils/test/com/cloud/utils/encoding/UrlEncoderTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/encoding/UrlEncoderTest.java b/utils/test/com/cloud/utils/encoding/UrlEncoderTest.java
index 322ac78..73d9a21 100644
--- a/utils/test/com/cloud/utils/encoding/UrlEncoderTest.java
+++ b/utils/test/com/cloud/utils/encoding/UrlEncoderTest.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package com.cloud.utils.encoding;
import org.junit.Assert;
[2/6] git commit: updated refs/heads/master to cba8e40
Posted by da...@apache.org.
Add registry interface
Registry interface will be used to store and discover extensions
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/78040f87
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/78040f87
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/78040f87
Branch: refs/heads/master
Commit: 78040f8769721ab68fa835dde199fbbc45167c2d
Parents: 9a083b9
Author: Darren Shepherd <da...@gmail.com>
Authored: Mon Sep 30 09:26:17 2013 -0700
Committer: Darren Shepherd <da...@gmail.com>
Committed: Mon Sep 30 09:26:17 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/utils/component/Registry.java | 50 ++++++++++++++++++++
1 file changed, 50 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78040f87/utils/src/com/cloud/utils/component/Registry.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/Registry.java b/utils/src/com/cloud/utils/component/Registry.java
new file mode 100644
index 0000000..c2a74ae
--- /dev/null
+++ b/utils/src/com/cloud/utils/component/Registry.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+package com.cloud.utils.component;
+
+import java.util.List;
+
+/**
+ * Simple interface to represents a registry of items
+ *
+ * @param <T>
+ */
+public interface Registry<T> extends Named {
+
+ /**
+ * Registers an item. If the item has already been registered the implementation
+ * should detect that it is registered and not re-register it.
+ *
+ * @param type
+ * @return true if register, false if not registered or already exists
+ */
+ boolean register(T type);
+
+ void unregister(T type);
+
+ /**
+ * Returns a list that will dynamically change as items are registered/unregister.
+ * The list is thread safe to iterate upon. Traversing the list using an index
+ * would not be safe as the size may changed during traversal.
+ *
+ * @return Unmodifiable list of registered items
+ */
+ List<T> getRegistered();
+
+}
[3/6] git commit: updated refs/heads/master to cba8e40
Posted by da...@apache.org.
Add ability to programatically disable CloudStack ComponentConext intialization
As we moved to a more Spring managed lifecycle, the lifecycle management
in ComponentContext is not needed. The transition to fully spring managed
will not happen all at once. The management server will be done first and
then AWSAPI and UsageServer will come later. This change allows the
ComponentContext in the context of the management server to be bypassed.
Note, by default, the ComponentContext will run its initialization.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/766a0a22
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/766a0a22
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/766a0a22
Branch: refs/heads/master
Commit: 766a0a2229e270e964adc9801eccd010475d0b9a
Parents: 78040f8
Author: Darren Shepherd <da...@gmail.com>
Authored: Mon Sep 30 09:30:54 2013 -0700
Committer: Darren Shepherd <da...@gmail.com>
Committed: Mon Sep 30 09:30:54 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/utils/component/ComponentContext.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/766a0a22/utils/src/com/cloud/utils/component/ComponentContext.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/ComponentContext.java b/utils/src/com/cloud/utils/component/ComponentContext.java
index 065fd3b..332e4ec 100644
--- a/utils/src/com/cloud/utils/component/ComponentContext.java
+++ b/utils/src/com/cloud/utils/component/ComponentContext.java
@@ -49,6 +49,7 @@ public class ComponentContext implements ApplicationContextAware {
private static final Logger s_logger = Logger.getLogger(ComponentContext.class);
private static ApplicationContext s_appContext;
+ private static boolean s_initializeBeans = true;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
@@ -61,6 +62,9 @@ public class ComponentContext implements ApplicationContextAware {
}
public static void initComponentsLifeCycle() {
+ if ( ! s_initializeBeans )
+ return;
+
AutowireCapableBeanFactory beanFactory = s_appContext.getAutowireCapableBeanFactory();
Map<String, ComponentMethodInterceptable> interceptableComponents = getApplicationContext().getBeansOfType(ComponentMethodInterceptable.class);
@@ -234,4 +238,12 @@ public class ComponentContext implements ApplicationContextAware {
beanFactory.autowireBean(instance);
return (T)instance;
}
+
+ public boolean isInitializeBeans() {
+ return s_initializeBeans;
+ }
+
+ public void setInitializeBeans(boolean initializeBeans) {
+ s_initializeBeans = initializeBeans;
+ }
}