|
25 | 25 | import java.util.Map; |
26 | 26 | import java.util.regex.Pattern; |
27 | 27 |
|
| 28 | +import javax.inject.Inject; |
| 29 | + |
28 | 30 | import org.apache.cloudstack.query.QueryService; |
29 | 31 | import org.apache.log4j.Logger; |
30 | 32 |
|
@@ -109,84 +111,43 @@ public enum CommandType { |
109 | 111 | @Parameter(name = "response", type = CommandType.STRING) |
110 | 112 | private String responseType; |
111 | 113 |
|
112 | | - public static ConfigurationService _configService; |
113 | | - public static AccountService _accountService; |
114 | | - public static UserVmService _userVmService; |
115 | | - public static ManagementService _mgr; |
116 | | - public static StorageService _storageService; |
117 | | - public static ResourceService _resourceService; |
118 | | - public static NetworkService _networkService; |
119 | | - public static TemplateService _templateService; |
120 | | - public static SecurityGroupService _securityGroupService; |
121 | | - public static SnapshotService _snapshotService; |
122 | | - public static ConsoleProxyService _consoleProxyService; |
123 | | - public static VpcVirtualNetworkApplianceService _routerService; |
124 | | - public static ResponseGenerator _responseGenerator; |
125 | | - public static EntityManager _entityMgr; |
126 | | - public static RulesService _rulesService; |
127 | | - public static AutoScaleService _autoScaleService; |
128 | | - public static LoadBalancingRulesService _lbService; |
129 | | - public static RemoteAccessVpnService _ravService; |
130 | | - public static BareMetalVmService _bareMetalVmService; |
131 | | - public static ProjectService _projectService; |
132 | | - public static FirewallService _firewallService; |
133 | | - public static DomainService _domainService; |
134 | | - public static ResourceLimitService _resourceLimitService; |
135 | | - public static IdentityService _identityService; |
136 | | - public static StorageNetworkService _storageNetworkService; |
137 | | - public static TaggedResourceService _taggedResourceService; |
138 | | - public static VpcService _vpcService; |
139 | | - public static NetworkACLService _networkACLService; |
140 | | - public static Site2SiteVpnService _s2sVpnService; |
141 | | - |
142 | | - public static QueryService _queryService; |
143 | | - |
144 | | - public static void setComponents(ResponseGenerator generator) { |
145 | | - _mgr = ComponentContext.getComponent(ManagementService.class); |
146 | | - _accountService = ComponentContext.getComponent(AccountService.class); |
147 | | - _configService = ComponentContext.getComponent(ConfigurationService.class); |
148 | | - |
149 | | - _userVmService = ComponentContext.getComponent(UserVmService.class); |
150 | | - |
151 | | - // TODO, ugly and will change soon |
152 | | - // |
153 | | - Map<String, UserVmService> svmServices = ComponentContext.getComponentsOfType(UserVmService.class); |
154 | | - _userVmService = svmServices.get("BareMetalVmManagerImpl"); |
155 | | - |
156 | | - _storageService = ComponentContext.getComponent(StorageService.class); |
157 | | - _resourceService = ComponentContext.getComponent(ResourceService.class); |
158 | | - |
159 | | - _networkService = ComponentContext.getComponent(NetworkService.class); |
160 | | - _templateService = ComponentContext.getComponent(TemplateService.class); |
161 | | - |
162 | | - // TODO, will change to looking for primary component |
163 | | - // ugly binding to a specific implementation |
164 | | - Map<String, SecurityGroupService> _sgServices = ComponentContext.getComponentsOfType(SecurityGroupService.class); |
165 | | - _securityGroupService = _sgServices.get("SecurityGroupManagerImpl2"); |
166 | | - |
167 | | - _snapshotService = ComponentContext.getComponent(SnapshotService.class); |
168 | | - _consoleProxyService = ComponentContext.getComponent(ConsoleProxyService.class); |
169 | | - _routerService = ComponentContext.getComponent(VpcVirtualNetworkApplianceService.class); |
170 | | - _entityMgr = ComponentContext.getComponent(EntityManager.class); |
171 | | - _rulesService = ComponentContext.getComponent(RulesService.class); |
172 | | - _lbService = ComponentContext.getComponent(LoadBalancingRulesService.class); |
173 | | - _ravService = ComponentContext.getComponent(RemoteAccessVpnService.class); |
174 | | - _responseGenerator = generator; |
175 | | - _bareMetalVmService = ComponentContext.getComponent(BareMetalVmService.class); |
176 | | - _projectService = ComponentContext.getComponent(ProjectService.class); |
177 | | - _firewallService = ComponentContext.getComponent(FirewallService.class); |
178 | | - _domainService = ComponentContext.getComponent(DomainService.class); |
179 | | - _resourceLimitService = ComponentContext.getComponent(ResourceLimitService.class); |
180 | | - _identityService = ComponentContext.getComponent(IdentityService.class); |
181 | | - _storageNetworkService = ComponentContext.getComponent(StorageNetworkService.class); |
182 | | - _taggedResourceService = ComponentContext.getComponent(TaggedResourceService.class); |
183 | | - _vpcService = ComponentContext.getComponent(VpcService.class); |
184 | | - _networkACLService = ComponentContext.getComponent(NetworkACLService.class); |
185 | | - _s2sVpnService = ComponentContext.getComponent(Site2SiteVpnService.class); |
186 | | - } |
| 114 | + @Inject public ConfigurationService _configService; |
| 115 | + @Inject public AccountService _accountService; |
| 116 | + @Inject public UserVmService _userVmService; |
| 117 | + @Inject public ManagementService _mgr; |
| 118 | + @Inject public StorageService _storageService; |
| 119 | + @Inject public ResourceService _resourceService; |
| 120 | + @Inject public NetworkService _networkService; |
| 121 | + @Inject public TemplateService _templateService; |
| 122 | + @Inject public SecurityGroupService _securityGroupService; |
| 123 | + @Inject public SnapshotService _snapshotService; |
| 124 | + @Inject public ConsoleProxyService _consoleProxyService; |
| 125 | + @Inject public VpcVirtualNetworkApplianceService _routerService; |
| 126 | + @Inject public ResponseGenerator _responseGenerator; |
| 127 | + @Inject public EntityManager _entityMgr; |
| 128 | + @Inject public RulesService _rulesService; |
| 129 | + @Inject public AutoScaleService _autoScaleService; |
| 130 | + @Inject public LoadBalancingRulesService _lbService; |
| 131 | + @Inject public RemoteAccessVpnService _ravService; |
| 132 | + @Inject public BareMetalVmService _bareMetalVmService; |
| 133 | + @Inject public ProjectService _projectService; |
| 134 | + @Inject public FirewallService _firewallService; |
| 135 | + @Inject public DomainService _domainService; |
| 136 | + @Inject public ResourceLimitService _resourceLimitService; |
| 137 | + @Inject public IdentityService _identityService; |
| 138 | + @Inject public StorageNetworkService _storageNetworkService; |
| 139 | + @Inject public TaggedResourceService _taggedResourceService; |
| 140 | + @Inject public VpcService _vpcService; |
| 141 | + @Inject public NetworkACLService _networkACLService; |
| 142 | + @Inject public Site2SiteVpnService _s2sVpnService; |
| 143 | + |
| 144 | + @Inject public QueryService _queryService; |
187 | 145 |
|
188 | 146 | public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException; |
189 | 147 |
|
| 148 | + public void configure() { |
| 149 | + } |
| 150 | + |
190 | 151 | public String getResponseType() { |
191 | 152 | if (responseType == null) { |
192 | 153 | return RESPONSE_TYPE_XML; |
|
0 commit comments