mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Loadable components to be in separted Spring component bundling
This commit is contained in:
		
							parent
							
								
									53da542001
								
							
						
					
					
						commit
						f57dcaa820
					
				| @ -16,7 +16,6 @@ | ||||
| // under the License. | ||||
| package com.cloud.user; | ||||
| 
 | ||||
| 
 | ||||
| public class UserContext { | ||||
| 
 | ||||
|     private static ThreadLocal<UserContext> s_currentContext = new ThreadLocal<UserContext>(); | ||||
|  | ||||
| @ -25,7 +25,7 @@ | ||||
| 	</listener> | ||||
|     <context-param>     | ||||
|         <param-name>contextConfigLocation</param-name>     | ||||
|         <param-value>classpath:applicationContext.xml</param-value>     | ||||
|         <param-value>classpath:applicationContext.xml, classpath:componentContext.xml</param-value>     | ||||
|     </context-param> | ||||
|            | ||||
|     <servlet> | ||||
|  | ||||
| @ -13,6 +13,7 @@ | ||||
|                       http://www.springframework.org/schema/context/spring-context-3.0.xsd">                      | ||||
| 
 | ||||
|   <context:annotation-config /> | ||||
| 
 | ||||
|   <context:component-scan base-package="org.apache.cloudstack, com.cloud" /> | ||||
| 
 | ||||
|   <!-- | ||||
|  | ||||
							
								
								
									
										52
									
								
								client/tomcatconf/componentContext.xml.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								client/tomcatconf/componentContext.xml.in
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | ||||
| <beans xmlns="http://www.springframework.org/schema/beans" | ||||
|   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  | ||||
|   xmlns:context="http://www.springframework.org/schema/context" | ||||
|   xmlns:tx="http://www.springframework.org/schema/tx"  | ||||
|   xmlns:aop="http://www.springframework.org/schema/aop" | ||||
|   xsi:schemaLocation="http://www.springframework.org/schema/beans | ||||
|                       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | ||||
|                       http://www.springframework.org/schema/tx  | ||||
|                       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd | ||||
|                       http://www.springframework.org/schema/aop | ||||
|                       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd | ||||
|                       http://www.springframework.org/schema/context | ||||
|                       http://www.springframework.org/schema/context/spring-context-3.0.xsd">                      | ||||
| 
 | ||||
| 
 | ||||
|   <!-- | ||||
|       Configurable components | ||||
|   --> | ||||
|   <bean id="ManagementServerExtImpl" class ="com.cloud.server.ManagementServerExtImpl" /> | ||||
| 
 | ||||
|     | ||||
|   <!-- | ||||
|       Network Elements | ||||
|   --> | ||||
|   <bean id="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"> | ||||
|     <property name="name" value="VirtualRouter"/> | ||||
|   </bean> | ||||
|   <bean id="Ovs" class="com.cloud.network.element.OvsElement"> | ||||
|     <property name="name" value="Ovs"/> | ||||
|   </bean> | ||||
|   <bean id="ExternalDhcpServer" class="com.cloud.network.element.ExternalDhcpElement"> | ||||
|     <property name="name" value="ExternalDhcpServer"/> | ||||
|   </bean> | ||||
|   <bean id="BareMetal" class="com.cloud.network.element.BareMetalElement"> | ||||
|     <property name="name" value="BareMetal"/> | ||||
|   </bean> | ||||
|   <bean id="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement"> | ||||
|     <property name="name" value="SecurityGroupProvider"/> | ||||
|   </bean> | ||||
|   <bean id="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement"> | ||||
|     <property name="name" value="VpcVirtualRouter"/> | ||||
|   </bean> | ||||
|   <bean id="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"> | ||||
|     <property name="name" value="NiciraNvp"/> | ||||
|   </bean> | ||||
|                     | ||||
|   <!-- | ||||
|      Adapters | ||||
|   --> | ||||
|   <bean id="StaticRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker"/> | ||||
|    | ||||
| </beans> | ||||
| @ -30,7 +30,6 @@ import javax.naming.ConfigurationException; | ||||
| 
 | ||||
| import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.agent.AgentManager; | ||||
| import com.cloud.agent.api.ConfigurePortForwardingRulesOnLogicalRouterAnswer; | ||||
| @ -121,7 +120,6 @@ import com.cloud.vm.VirtualMachine; | ||||
| import com.cloud.vm.VirtualMachineProfile; | ||||
| import com.cloud.vm.dao.NicDao; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = NetworkElement.class) | ||||
| public class NiciraNvpElement extends AdapterBase implements | ||||
| ConnectivityProvider, SourceNatServiceProvider, | ||||
|  | ||||
| @ -22,8 +22,6 @@ import java.util.Set; | ||||
| import javax.ejb.Local; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.deploy.DeployDestination; | ||||
| import com.cloud.exception.ConcurrentOperationException; | ||||
| import com.cloud.exception.InsufficientCapacityException; | ||||
| @ -42,7 +40,6 @@ import com.cloud.vm.ReservationContext; | ||||
| import com.cloud.vm.VirtualMachine; | ||||
| import com.cloud.vm.VirtualMachineProfile; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = NetworkElement.class) | ||||
| public class OvsElement extends AdapterBase implements NetworkElement { | ||||
|     @Inject | ||||
|  | ||||
| @ -22,6 +22,7 @@ import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| import javax.annotation.PostConstruct; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.apache.cloudstack.api.ApiConstants.HostDetails; | ||||
| @ -41,6 +42,7 @@ import org.apache.cloudstack.api.response.StoragePoolResponse; | ||||
| import org.apache.cloudstack.api.response.UserResponse; | ||||
| import org.apache.cloudstack.api.response.UserVmResponse; | ||||
| import org.apache.cloudstack.api.response.VolumeResponse; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.api.query.dao.AccountJoinDao; | ||||
| import com.cloud.api.query.dao.AsyncJobJoinDao; | ||||
| @ -249,6 +251,7 @@ import com.cloud.vm.dao.UserVmDao; | ||||
| import com.cloud.vm.dao.UserVmDetailsDao; | ||||
| import com.cloud.vm.dao.VMInstanceDao; | ||||
| 
 | ||||
| @Component | ||||
| public class ApiDBUtils { | ||||
|     private static ManagementServer _ms; | ||||
|     @Inject static AsyncJobManager _asyncMgr; | ||||
| @ -343,7 +346,191 @@ public class ApiDBUtils { | ||||
|     @Inject static SnapshotPolicyDao _snapshotPolicyDao; | ||||
|     @Inject static AsyncJobDao _asyncJobDao; | ||||
| 
 | ||||
|     static { | ||||
|     @Inject private ManagementServer ms; | ||||
|     @Inject public AsyncJobManager asyncMgr; | ||||
|     @Inject private SecurityGroupManager securityGroupMgr; | ||||
|     @Inject private StorageManager storageMgr; | ||||
|     @Inject private UserVmManager userVmMgr; | ||||
|     @Inject private NetworkManager networkMgr; | ||||
|     @Inject private StatsCollector statsCollector; | ||||
| 
 | ||||
|     @Inject private AccountDao accountDao; | ||||
|     @Inject private AccountVlanMapDao accountVlanMapDao; | ||||
|     @Inject private ClusterDao clusterDao; | ||||
|     @Inject private CapacityDao capacityDao; | ||||
|     @Inject private DiskOfferingDao diskOfferingDao; | ||||
|     @Inject private DomainDao domainDao; | ||||
|     @Inject private DomainRouterDao domainRouterDao; | ||||
|     @Inject private DomainRouterJoinDao domainRouterJoinDao; | ||||
|     @Inject private GuestOSDao guestOSDao; | ||||
|     @Inject private GuestOSCategoryDao guestOSCategoryDao; | ||||
|     @Inject private HostDao hostDao; | ||||
|     @Inject private IPAddressDao ipAddressDao; | ||||
|     @Inject private LoadBalancerDao loadBalancerDao; | ||||
|     @Inject private SecurityGroupDao securityGroupDao; | ||||
|     @Inject private SecurityGroupJoinDao securityGroupJoinDao; | ||||
|     @Inject private NetworkRuleConfigDao networkRuleConfigDao; | ||||
|     @Inject private HostPodDao podDao; | ||||
|     @Inject private ServiceOfferingDao serviceOfferingDao; | ||||
|     @Inject private SnapshotDao snapshotDao; | ||||
|     @Inject private StoragePoolDao storagePoolDao; | ||||
|     @Inject private VMTemplateDao templateDao; | ||||
|     @Inject private VMTemplateDetailsDao templateDetailsDao; | ||||
|     @Inject private VMTemplateHostDao templateHostDao; | ||||
|     @Inject private VMTemplateSwiftDao templateSwiftDao; | ||||
|     @Inject private VMTemplateS3Dao templateS3Dao; | ||||
|     @Inject private UploadDao uploadDao; | ||||
|     @Inject private UserDao userDao; | ||||
|     @Inject private UserStatisticsDao userStatsDao; | ||||
|     @Inject private UserVmDao userVmDao; | ||||
|     @Inject private UserVmJoinDao userVmJoinDao; | ||||
|     @Inject private VlanDao vlanDao; | ||||
|     @Inject private VolumeDao volumeDao; | ||||
|     @Inject private Site2SiteVpnGatewayDao site2SiteVpnGatewayDao; | ||||
|     @Inject private Site2SiteCustomerGatewayDao site2SiteCustomerGatewayDao; | ||||
|     @Inject private VolumeHostDao volumeHostDao; | ||||
|     @Inject private DataCenterDao zoneDao; | ||||
|     @Inject private NetworkOfferingDao networkOfferingDao; | ||||
|     @Inject private NetworkDao networkDao; | ||||
|     @Inject private PhysicalNetworkDao physicalNetworkDao; | ||||
|     @Inject private ConfigurationService configMgr; | ||||
|     @Inject private ConfigurationDao configDao; | ||||
|     @Inject private ConsoleProxyDao consoleProxyDao; | ||||
|     @Inject private FirewallRulesCidrsDao firewallCidrsDao; | ||||
|     @Inject private VMInstanceDao vmDao; | ||||
|     @Inject private ResourceLimitService resourceLimitMgr; | ||||
|     @Inject private ProjectService projectMgr; | ||||
|     @Inject private ResourceManager resourceMgr; | ||||
|     @Inject private AccountDetailsDao accountDetailsDao; | ||||
|     @Inject private NetworkDomainDao networkDomainDao; | ||||
|     @Inject private HighAvailabilityManager haMgr; | ||||
|     @Inject private VpcManager vpcMgr; | ||||
|     @Inject private TaggedResourceService taggedResourceService; | ||||
|     @Inject private UserVmDetailsDao userVmDetailsDao; | ||||
|     @Inject private SSHKeyPairDao sshKeyPairDao; | ||||
|      | ||||
|     @Inject private ConditionDao asConditionDao; | ||||
|     @Inject private AutoScalePolicyConditionMapDao asPolicyConditionMapDao; | ||||
|     @Inject private AutoScaleVmGroupPolicyMapDao asVmGroupPolicyMapDao; | ||||
|     @Inject private AutoScalePolicyDao asPolicyDao; | ||||
|     @Inject private AutoScaleVmProfileDao asVmProfileDao; | ||||
|     @Inject private AutoScaleVmGroupDao asVmGroupDao; | ||||
|     @Inject private CounterDao counterDao; | ||||
|     @Inject private ResourceTagJoinDao tagJoinDao; | ||||
|     @Inject private EventJoinDao eventJoinDao; | ||||
|     @Inject private InstanceGroupJoinDao vmGroupJoinDao; | ||||
|     @Inject private UserAccountJoinDao userAccountJoinDao; | ||||
|     @Inject private ProjectJoinDao projectJoinDao; | ||||
|     @Inject private ProjectAccountJoinDao projectAccountJoinDao; | ||||
|     @Inject private ProjectInvitationJoinDao projectInvitationJoinDao; | ||||
|     @Inject private HostJoinDao hostJoinDao; | ||||
|     @Inject private VolumeJoinDao volJoinDao; | ||||
|     @Inject private StoragePoolJoinDao poolJoinDao; | ||||
|     @Inject private AccountJoinDao accountJoinDao; | ||||
|     @Inject private AsyncJobJoinDao jobJoinDao; | ||||
| 
 | ||||
|     @Inject private PhysicalNetworkTrafficTypeDao physicalNetworkTrafficTypeDao; | ||||
|     @Inject private PhysicalNetworkServiceProviderDao physicalNetworkServiceProviderDao; | ||||
|     @Inject private FirewallRulesDao firewallRuleDao; | ||||
|     @Inject private StaticRouteDao staticRouteDao; | ||||
|     @Inject private VpcGatewayDao vpcGatewayDao; | ||||
|     @Inject private VpcDao vpcDao; | ||||
|     @Inject private VpcOfferingDao vpcOfferingDao; | ||||
|     @Inject private SnapshotPolicyDao snapshotPolicyDao; | ||||
|     @Inject private AsyncJobDao asyncJobDao; | ||||
|     | ||||
|     @PostConstruct | ||||
|     void init() { | ||||
|         _ms = ms; | ||||
|         _asyncMgr = asyncMgr; | ||||
|         _securityGroupMgr = securityGroupMgr; | ||||
|         _storageMgr = storageMgr; | ||||
|         _userVmMgr = userVmMgr; | ||||
|         _networkMgr = networkMgr; | ||||
|         _configMgr = configMgr; | ||||
| 
 | ||||
|         _accountDao = accountDao; | ||||
|         _accountVlanMapDao = accountVlanMapDao; | ||||
|         _clusterDao = clusterDao; | ||||
|         _capacityDao = capacityDao; | ||||
|         _diskOfferingDao = diskOfferingDao; | ||||
|         _domainDao = domainDao; | ||||
|         _domainRouterDao = domainRouterDao; | ||||
|         _domainRouterJoinDao = domainRouterJoinDao; | ||||
|         _guestOSDao = guestOSDao; | ||||
|         _guestOSCategoryDao = guestOSCategoryDao; | ||||
|         _hostDao = hostDao; | ||||
|         _ipAddressDao = ipAddressDao; | ||||
|         _loadBalancerDao = loadBalancerDao; | ||||
|         _networkRuleConfigDao = networkRuleConfigDao; | ||||
|         _podDao = podDao; | ||||
|         _serviceOfferingDao = serviceOfferingDao; | ||||
|         _snapshotDao = snapshotDao; | ||||
|         _storagePoolDao = storagePoolDao; | ||||
|         _templateDao = templateDao; | ||||
|         _templateDetailsDao = templateDetailsDao; | ||||
|         _templateHostDao = templateHostDao; | ||||
|         _templateSwiftDao = templateSwiftDao; | ||||
|         _templateS3Dao = templateS3Dao; | ||||
|         _uploadDao = uploadDao; | ||||
|         _userDao = userDao; | ||||
|         _userStatsDao = userStatsDao; | ||||
|         _userVmDao = userVmDao; | ||||
|         _userVmJoinDao = userVmJoinDao; | ||||
|         _vlanDao = vlanDao; | ||||
|         _volumeDao = volumeDao; | ||||
|         _site2SiteVpnGatewayDao = site2SiteVpnGatewayDao; | ||||
|         _site2SiteCustomerGatewayDao = site2SiteCustomerGatewayDao; | ||||
|         _volumeHostDao = volumeHostDao; | ||||
|         _zoneDao = zoneDao; | ||||
|         _securityGroupDao = securityGroupDao; | ||||
|         _securityGroupJoinDao = securityGroupJoinDao; | ||||
|         _networkOfferingDao = networkOfferingDao; | ||||
|         _networkDao = networkDao; | ||||
|         _physicalNetworkDao = physicalNetworkDao; | ||||
|         _configDao = configDao; | ||||
|         _consoleProxyDao = consoleProxyDao; | ||||
|         _firewallCidrsDao = firewallCidrsDao; | ||||
|         _vmDao = vmDao; | ||||
|         _resourceLimitMgr = resourceLimitMgr; | ||||
|         _projectMgr = projectMgr; | ||||
|         _resourceMgr = resourceMgr; | ||||
|         _accountDetailsDao = accountDetailsDao; | ||||
|         _networkDomainDao = networkDomainDao; | ||||
|         _haMgr = haMgr; | ||||
|         _vpcMgr = vpcMgr; | ||||
|         _taggedResourceService = taggedResourceService; | ||||
|         _sshKeyPairDao = sshKeyPairDao; | ||||
|         _userVmDetailsDao = userVmDetailsDao; | ||||
|         _asConditionDao = asConditionDao; | ||||
|         _asPolicyDao = asPolicyDao; | ||||
|         _asPolicyConditionMapDao = asPolicyConditionMapDao; | ||||
|         _counterDao = counterDao; | ||||
|         _asVmGroupPolicyMapDao = asVmGroupPolicyMapDao; | ||||
|         _tagJoinDao = tagJoinDao; | ||||
|         _vmGroupJoinDao = vmGroupJoinDao; | ||||
|         _eventJoinDao = eventJoinDao; | ||||
|         _userAccountJoinDao = userAccountJoinDao; | ||||
|         _projectJoinDao = projectJoinDao; | ||||
|         _projectAccountJoinDao = projectAccountJoinDao; | ||||
|         _projectInvitationJoinDao = projectInvitationJoinDao; | ||||
|         _hostJoinDao = hostJoinDao; | ||||
|         _volJoinDao = volJoinDao; | ||||
|         _poolJoinDao = poolJoinDao; | ||||
|         _accountJoinDao = accountJoinDao; | ||||
|         _jobJoinDao = jobJoinDao; | ||||
| 
 | ||||
|         _physicalNetworkTrafficTypeDao = physicalNetworkTrafficTypeDao; | ||||
|         _physicalNetworkServiceProviderDao = physicalNetworkServiceProviderDao; | ||||
|         _firewallRuleDao = firewallRuleDao; | ||||
|         _staticRouteDao = staticRouteDao; | ||||
|         _vpcGatewayDao = vpcGatewayDao; | ||||
|         _asVmProfileDao = asVmProfileDao; | ||||
|         _asVmGroupDao = asVmGroupDao; | ||||
|         _vpcDao = vpcDao; | ||||
|         _vpcOfferingDao = vpcOfferingDao; | ||||
|         _snapshotPolicyDao = snapshotPolicyDao; | ||||
|         _asyncJobDao = asyncJobDao; | ||||
| 
 | ||||
|         // Note: stats collector should already have been initialized by this time, otherwise a null instance is returned | ||||
|         _statsCollector = StatsCollector.getInstance(); | ||||
|  | ||||
| @ -148,8 +148,8 @@ public class ApiServer implements HttpRequestHandler { | ||||
|     @Inject ApiDispatcher _dispatcher; | ||||
| 
 | ||||
|     @Inject private AccountManager _accountMgr; | ||||
|     @Inject private DomainManager _domainMgr = null; | ||||
|     @Inject private AsyncJobManager _asyncMgr = null; | ||||
|     @Inject private DomainManager _domainMgr; | ||||
|     @Inject private AsyncJobManager _asyncMgr; | ||||
|     @Inject private ConfigurationDao _configDao; | ||||
| 
 | ||||
|     @Inject List<PluggableService> _pluggableServices; | ||||
| @ -552,7 +552,7 @@ public class ApiServer implements HttpRequestHandler { | ||||
|             } | ||||
| 
 | ||||
|             String commandName = command[0]; | ||||
| 
 | ||||
| /* | ||||
|             // if userId not null, that mean that user is logged in | ||||
|             if (userId != null) { | ||||
|                 User user = ApiDBUtils.findUserById(userId); | ||||
| @ -568,7 +568,7 @@ public class ApiServer implements HttpRequestHandler { | ||||
|                     throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command does not exist or it is not available for user"); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
| */ | ||||
|             // - build a request string with sorted params, make sure it's all lowercase | ||||
|             // - sign the request, verify the signature is the same | ||||
|             List<String> parameterNames = new ArrayList<String>(); | ||||
|  | ||||
| @ -214,8 +214,7 @@ public class QueryManagerImpl implements QueryService, Manager { | ||||
|     @Override | ||||
|     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { | ||||
|         _name = name; | ||||
|         // _responseGenerator = new ViewResponseHelper(); | ||||
|         return false; | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | ||||
| @ -27,6 +27,8 @@ import com.cloud.api.ApiResponseHelper; | ||||
| import com.cloud.api.query.vo.EventJoinVO; | ||||
| 
 | ||||
| import org.apache.cloudstack.api.response.EventResponse; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.event.Event; | ||||
| import com.cloud.event.Event.State; | ||||
| import com.cloud.utils.db.Filter; | ||||
| @ -34,7 +36,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| 
 | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={EventJoinDao.class}) | ||||
| public class EventJoinDaoImpl extends GenericDaoBase<EventJoinVO, Long> implements EventJoinDao { | ||||
|     public static final Logger s_logger = Logger.getLogger(EventJoinDaoImpl.class); | ||||
|  | ||||
| @ -133,6 +133,7 @@ import com.cloud.utils.AnnotationHelper; | ||||
| import com.cloud.utils.NumbersUtil; | ||||
| import com.cloud.utils.Pair; | ||||
| import com.cloud.utils.component.AdapterBase; | ||||
| import com.cloud.utils.component.ComponentContext; | ||||
| import com.cloud.utils.component.Manager; | ||||
| import com.cloud.utils.concurrency.NamedThreadFactory; | ||||
| import com.cloud.utils.db.JoinBuilder.JoinType; | ||||
| @ -212,11 +213,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag | ||||
|     @Inject | ||||
|     PodVlanMapDao _podVlanMapDao; | ||||
|      | ||||
|     //@com.cloud.utils.component.Inject(adapter = NetworkGuru.class) | ||||
|     @Inject  | ||||
|     List<NetworkGuru> _networkGurus; | ||||
| 
 | ||||
|     // @com.cloud.utils.component.Inject(adapter = NetworkElement.class) | ||||
|     @Inject  | ||||
|     List<NetworkElement> _networkElements; | ||||
|      | ||||
| @ -1540,6 +1539,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag | ||||
|                             "multiple NetworkElements found for Provider: " + implementedProvider.getName()); | ||||
|                     return false; | ||||
|                 } | ||||
|                 s_logger.info("add element/provider mapping. provider: " + implementedProvider.getName() + " -> " + element.getName() | ||||
|                 		+ ", class: " + ComponentContext.getTargetClass(element).getName()); | ||||
|                 s_providerToNetworkElementMap.put(implementedProvider.getName(), element.getName()); | ||||
|             } | ||||
|             if (capabilities != null && implementedProvider != null) { | ||||
|  | ||||
| @ -16,7 +16,6 @@ | ||||
| // under the License. | ||||
| package com.cloud.network.element; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| @ -24,7 +23,6 @@ import javax.ejb.Local; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.baremetal.ExternalDhcpManager; | ||||
| import com.cloud.deploy.DeployDestination; | ||||
| @ -49,7 +47,6 @@ import com.cloud.vm.VirtualMachine; | ||||
| import com.cloud.vm.VirtualMachineProfile; | ||||
| import com.cloud.vm.dao.NicDao; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value=NetworkElement.class) | ||||
| public class BareMetalElement extends AdapterBase implements NetworkElement { | ||||
| 	private static final Logger s_logger = Logger.getLogger(BareMetalElement.class); | ||||
|  | ||||
| @ -17,7 +17,6 @@ | ||||
| package com.cloud.network.element; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| @ -25,7 +24,6 @@ import javax.ejb.Local; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.agent.AgentManager; | ||||
| import com.cloud.agent.AgentManager.OnError; | ||||
| @ -64,7 +62,6 @@ import com.cloud.vm.VirtualMachineProfile; | ||||
| import com.cloud.vm.dao.DomainRouterDao; | ||||
| import com.cloud.vm.dao.UserVmDao; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = NetworkElement.class) | ||||
| public class CloudZonesNetworkElement extends AdapterBase implements NetworkElement, UserDataServiceProvider { | ||||
|     private static final Logger s_logger = Logger.getLogger(CloudZonesNetworkElement.class); | ||||
|  | ||||
| @ -17,7 +17,6 @@ | ||||
| package com.cloud.network.element; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| @ -25,7 +24,6 @@ import javax.ejb.Local; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.baremetal.ExternalDhcpManager; | ||||
| import com.cloud.dc.DataCenter; | ||||
| @ -51,7 +49,6 @@ import com.cloud.vm.ReservationContext; | ||||
| import com.cloud.vm.VirtualMachine; | ||||
| import com.cloud.vm.VirtualMachineProfile; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = NetworkElement.class) | ||||
| public class ExternalDhcpElement extends AdapterBase implements NetworkElement, DhcpServiceProvider { | ||||
|     private static final Logger s_logger = Logger.getLogger(ExternalDhcpElement.class); | ||||
|  | ||||
| @ -17,14 +17,11 @@ | ||||
| package com.cloud.network.element; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| import javax.ejb.Local; | ||||
| 
 | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.deploy.DeployDestination; | ||||
| import com.cloud.exception.ConcurrentOperationException; | ||||
| import com.cloud.exception.InsufficientCapacityException; | ||||
| @ -42,7 +39,6 @@ import com.cloud.vm.ReservationContext; | ||||
| import com.cloud.vm.VirtualMachine; | ||||
| import com.cloud.vm.VirtualMachineProfile; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value=NetworkElement.class) | ||||
| public class SecurityGroupElement extends AdapterBase implements NetworkElement { | ||||
|     private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities(); | ||||
|  | ||||
| @ -29,7 +29,6 @@ import com.cloud.utils.PropertiesUtil; | ||||
| import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd; | ||||
| import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd; | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.configuration.ConfigurationManager; | ||||
| import com.cloud.configuration.dao.ConfigurationDao; | ||||
| @ -90,7 +89,6 @@ import com.cloud.vm.dao.DomainRouterDao; | ||||
| import com.cloud.vm.dao.UserVmDao; | ||||
| import com.google.gson.Gson; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = NetworkElement.class) | ||||
| public class VirtualRouterElement extends AdapterBase implements VirtualRouterElementService, DhcpServiceProvider,  | ||||
|     UserDataServiceProvider, SourceNatServiceProvider, StaticNatServiceProvider, FirewallServiceProvider, | ||||
|  | ||||
| @ -26,7 +26,6 @@ import javax.ejb.Local; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.dc.DataCenter; | ||||
| import com.cloud.deploy.DeployDestination; | ||||
| @ -63,7 +62,6 @@ import com.cloud.vm.VirtualMachine; | ||||
| import com.cloud.vm.VirtualMachine.Type; | ||||
| import com.cloud.vm.VirtualMachineProfile; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = NetworkElement.class) | ||||
| public class VpcVirtualRouterElement extends VirtualRouterElement implements VpcProvider, Site2SiteVpnServiceProvider, NetworkACLServiceProvider{ | ||||
|     private static final Logger s_logger = Logger.getLogger(VpcVirtualRouterElement.class); | ||||
|  | ||||
							
								
								
									
										185
									
								
								server/src/com/cloud/server/CloudStackComponentComposer.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										185
									
								
								server/src/com/cloud/server/CloudStackComponentComposer.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,185 @@ | ||||
| // 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.server; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import javax.annotation.PostConstruct; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.agent.AgentManager; | ||||
| import com.cloud.alert.AlertManagerImpl; | ||||
| import com.cloud.api.query.QueryManagerImpl; | ||||
| import com.cloud.async.AsyncJobManager; | ||||
| import com.cloud.async.SyncQueueManager; | ||||
| import com.cloud.capacity.CapacityManagerImpl; | ||||
| import com.cloud.cluster.CheckPointManagerImpl; | ||||
| import com.cloud.cluster.ClusterFenceManagerImpl; | ||||
| import com.cloud.cluster.ClusterManagerImpl; | ||||
| import com.cloud.configuration.ConfigurationManager; | ||||
| import com.cloud.consoleproxy.ConsoleProxyManager; | ||||
| import com.cloud.dao.EntityManagerImpl; | ||||
| import com.cloud.ha.HighAvailabilityManager; | ||||
| import com.cloud.hypervisor.HypervisorGuruManagerImpl; | ||||
| import com.cloud.keystore.KeystoreManager; | ||||
| import com.cloud.maint.UpgradeManagerImpl; | ||||
| import com.cloud.network.ExternalLoadBalancerUsageManager; | ||||
| import com.cloud.network.NetworkManagerImpl; | ||||
| import com.cloud.network.StorageNetworkManager; | ||||
| import com.cloud.network.as.AutoScaleManagerImpl; | ||||
| import com.cloud.network.firewall.FirewallManagerImpl; | ||||
| import com.cloud.network.lb.LoadBalancingRulesManagerImpl; | ||||
| import com.cloud.network.router.VpcVirtualNetworkApplianceManager; | ||||
| import com.cloud.network.rules.RulesManagerImpl; | ||||
| import com.cloud.network.security.SecurityGroupManagerImpl2; | ||||
| import com.cloud.network.vpc.NetworkACLManagerImpl; | ||||
| import com.cloud.network.vpc.VpcManagerImpl; | ||||
| import com.cloud.network.vpn.RemoteAccessVpnManagerImpl; | ||||
| import com.cloud.network.vpn.Site2SiteVpnManagerImpl; | ||||
| import com.cloud.projects.ProjectManagerImpl; | ||||
| import com.cloud.resource.ResourceManagerImpl; | ||||
| import com.cloud.resourcelimit.ResourceLimitManagerImpl; | ||||
| import com.cloud.storage.OCFS2Manager; | ||||
| import com.cloud.storage.StorageManagerImpl; | ||||
| import com.cloud.storage.download.DownloadMonitor; | ||||
| import com.cloud.storage.s3.S3Manager; | ||||
| import com.cloud.storage.secondary.SecondaryStorageManagerImpl; | ||||
| import com.cloud.storage.snapshot.SnapshotManagerImpl; | ||||
| import com.cloud.storage.snapshot.SnapshotSchedulerImpl; | ||||
| import com.cloud.storage.swift.SwiftManager; | ||||
| import com.cloud.storage.upload.UploadMonitor; | ||||
| import com.cloud.tags.TaggedResourceManagerImpl; | ||||
| import com.cloud.template.TemplateManagerImpl; | ||||
| import com.cloud.user.AccountManagerImpl; | ||||
| import com.cloud.user.DomainManagerImpl; | ||||
| import com.cloud.utils.component.Manager; | ||||
| import com.cloud.vm.UserVmManagerImpl; | ||||
| import com.cloud.vm.VirtualMachineManager; | ||||
| 
 | ||||
| @Component | ||||
| public class CloudStackComponentComposer { | ||||
| 	@Inject CheckPointManagerImpl _checkPointMgr; | ||||
|     @Inject ClusterManagerImpl _clusterMgr; | ||||
|     @Inject ClusterFenceManagerImpl _clusterFenceMgr; | ||||
|     @Inject AgentManager _AgentMgr; | ||||
|     @Inject SyncQueueManager _sycnQueueMgr; | ||||
|     @Inject AsyncJobManager _jobMgr; | ||||
|     @Inject ConfigurationManager _confMgr; | ||||
|     @Inject AccountManagerImpl _accountMgr; | ||||
|     @Inject DomainManagerImpl _domainMgr; | ||||
|     @Inject ResourceLimitManagerImpl _resLimitMgr; | ||||
|     @Inject NetworkManagerImpl _networkMgr; | ||||
|     @Inject DownloadMonitor _downloadMonitor; | ||||
|     @Inject UploadMonitor _uploadMonitor; | ||||
|     @Inject KeystoreManager _ksMgr; | ||||
|     @Inject SecondaryStorageManagerImpl _ssMgr; | ||||
|     @Inject UserVmManagerImpl _userVmMgr; | ||||
|     @Inject UpgradeManagerImpl _upgradeMgr; | ||||
|     @Inject StorageManagerImpl _storageMgr; | ||||
|     @Inject AlertManagerImpl _alertMgr; | ||||
|     @Inject TemplateManagerImpl _tmplMgr; | ||||
|     @Inject SnapshotManagerImpl _snpahsotMgr; | ||||
|     @Inject SnapshotSchedulerImpl _snapshotScheduleMgr; | ||||
|     @Inject SecurityGroupManagerImpl2 _sgMgr; | ||||
|     @Inject EntityManagerImpl _entityMgr; | ||||
|     @Inject LoadBalancingRulesManagerImpl _lbRuleMgr; | ||||
|     @Inject AutoScaleManagerImpl _asMgr; | ||||
|     @Inject RulesManagerImpl _rulesMgr; | ||||
|     @Inject RemoteAccessVpnManagerImpl _acVpnMgr; | ||||
|     @Inject CapacityManagerImpl _capacityMgr; | ||||
|     @Inject VirtualMachineManager _vmMgr; | ||||
|     @Inject HypervisorGuruManagerImpl _hvGuruMgr; | ||||
|     @Inject ResourceManagerImpl _resMgr; | ||||
|     @Inject OCFS2Manager _ocfsMgr; | ||||
|     @Inject FirewallManagerImpl _fwMgr; | ||||
|     @Inject ConsoleProxyManager _cpMgr; | ||||
|     @Inject ProjectManagerImpl _prjMgr; | ||||
|     @Inject SwiftManager _swiftMgr; | ||||
|     @Inject S3Manager _s3Mgr; | ||||
|     @Inject StorageNetworkManager _storageNetworkMgr; | ||||
|     @Inject ExternalLoadBalancerUsageManager _extlbUsageMgr; | ||||
|     @Inject HighAvailabilityManager _haMgr; | ||||
|     @Inject VpcManagerImpl _vpcMgr; | ||||
|     @Inject VpcVirtualNetworkApplianceManager _vpcNetApplianceMgr; | ||||
|     @Inject NetworkACLManagerImpl _networkAclMgr; | ||||
|     @Inject TaggedResourceManagerImpl _taggedResMgr; | ||||
|     @Inject Site2SiteVpnManagerImpl _s2sVpnMgr; | ||||
|     @Inject QueryManagerImpl _queryMgr; | ||||
|      | ||||
|     List<Manager> _managers = new ArrayList<Manager>(); | ||||
| 
 | ||||
|     public CloudStackComponentComposer() { | ||||
|     } | ||||
|      | ||||
|     @PostConstruct | ||||
|     void init() { | ||||
|     	_managers.add(_checkPointMgr); | ||||
|         _managers.add(_clusterMgr); | ||||
|         _managers.add(_clusterFenceMgr); | ||||
|         _managers.add(_AgentMgr); | ||||
|         _managers.add(_sycnQueueMgr); | ||||
|         _managers.add(_jobMgr); | ||||
|         _managers.add(_confMgr); | ||||
|         _managers.add(_accountMgr); | ||||
|         _managers.add(_domainMgr); | ||||
|         _managers.add(_resLimitMgr); | ||||
|         _managers.add(_networkMgr); | ||||
|         _managers.add(_downloadMonitor); | ||||
|         _managers.add(_uploadMonitor); | ||||
|         _managers.add(_ksMgr); | ||||
|         _managers.add(_ssMgr); | ||||
|         _managers.add(_userVmMgr); | ||||
|         _managers.add(_upgradeMgr); | ||||
|         _managers.add(_storageMgr); | ||||
|         _managers.add(_alertMgr); | ||||
|         _managers.add(_tmplMgr); | ||||
|         _managers.add(_snpahsotMgr); | ||||
|         _managers.add(_snapshotScheduleMgr); | ||||
|         _managers.add(_sgMgr); | ||||
|         _managers.add(_entityMgr); | ||||
|         _managers.add(_lbRuleMgr); | ||||
|         _managers.add(_asMgr); | ||||
|         _managers.add(_rulesMgr); | ||||
|         _managers.add(_acVpnMgr); | ||||
|         _managers.add(_capacityMgr); | ||||
|         _managers.add(_vmMgr); | ||||
|         _managers.add(_hvGuruMgr); | ||||
|         _managers.add(_resMgr); | ||||
|         _managers.add(_ocfsMgr); | ||||
|         _managers.add(_fwMgr); | ||||
|         _managers.add(_cpMgr); | ||||
|         _managers.add(_prjMgr); | ||||
|         _managers.add(_swiftMgr); | ||||
|         _managers.add(_s3Mgr); | ||||
|         _managers.add(_storageNetworkMgr); | ||||
|         _managers.add(_extlbUsageMgr); | ||||
|         _managers.add(_haMgr); | ||||
|         _managers.add(_vpcMgr); | ||||
|         _managers.add(_vpcNetApplianceMgr); | ||||
|         _managers.add(_networkAclMgr); | ||||
|         _managers.add(_taggedResMgr); | ||||
|         _managers.add(_s2sVpnMgr); | ||||
|         _managers.add(_queryMgr); | ||||
|     } | ||||
|      | ||||
|     public List<Manager> getManagers() { | ||||
|     	return _managers; | ||||
|     } | ||||
| } | ||||
| @ -34,7 +34,6 @@ import com.cloud.exception.PermissionDeniedException; | ||||
| import com.cloud.projects.Project; | ||||
| import com.cloud.utils.PropertiesUtil; | ||||
| import org.apache.cloudstack.api.response.UsageTypeResponse; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.usage.UsageJobVO; | ||||
| import com.cloud.usage.UsageTypes; | ||||
| @ -49,7 +48,6 @@ import com.cloud.utils.db.Filter; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| 
 | ||||
| @Component | ||||
| public class ManagementServerExtImpl extends ManagementServerImpl implements ManagementServerExt { | ||||
|     @Inject private AccountDao _accountDao; | ||||
|     @Inject private DomainDao _domainDao; | ||||
|  | ||||
| @ -85,14 +85,12 @@ import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd; | ||||
| import org.apache.cloudstack.api.response.ExtractResponse; | ||||
| import org.apache.commons.codec.binary.Base64; | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.agent.AgentManager; | ||||
| import com.cloud.agent.api.GetVncPortAnswer; | ||||
| import com.cloud.agent.api.GetVncPortCommand; | ||||
| import com.cloud.agent.api.storage.CopyVolumeAnswer; | ||||
| import com.cloud.agent.api.storage.CopyVolumeCommand; | ||||
| import com.cloud.agent.manager.ClusteredAgentManagerImpl; | ||||
| import com.cloud.agent.manager.allocator.HostAllocator; | ||||
| import com.cloud.alert.Alert; | ||||
| import com.cloud.alert.AlertManager; | ||||
|  | ||||
| @ -41,6 +41,7 @@ import java.util.Map; | ||||
| import java.util.UUID; | ||||
| import java.util.concurrent.Callable; | ||||
| 
 | ||||
| import javax.annotation.PostConstruct; | ||||
| import javax.ejb.Local; | ||||
| import javax.inject.Inject; | ||||
| import javax.naming.ConfigurationException; | ||||
| @ -119,8 +120,7 @@ public class S3ManagerImpl implements S3Manager { | ||||
|     @Inject | ||||
|     private SecondaryStorageVmManager secondaryStorageVMManager; | ||||
| 
 | ||||
|     protected S3ManagerImpl() { | ||||
|         super(); | ||||
|     public S3ManagerImpl() { | ||||
|     } | ||||
|      | ||||
|     private void verifyConnection(final S3TO s3) throws DiscoveryException { | ||||
|  | ||||
| @ -1098,7 +1098,7 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe | ||||
|             s_logger.info("S3 secondary storage synchronization is disabled."); | ||||
|         } | ||||
| 
 | ||||
|         return false; | ||||
|         return true; | ||||
|     } | ||||
|      | ||||
|     protected TemplateManagerImpl() { | ||||
|  | ||||
| @ -36,6 +36,10 @@ public class AdapterBase implements Adapter { | ||||
|         return _name; | ||||
|     } | ||||
|      | ||||
|     public void setName(String name) { | ||||
|     	_name = name; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean start() { | ||||
|         return true; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user