Skip to content

Commit 1450547

Browse files
committed
Put usage server under Spring
1 parent 221ac72 commit 1450547

12 files changed

Lines changed: 279 additions & 16 deletions

File tree

engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/TestConfiguration.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import com.cloud.dc.dao.ClusterDao;
2828
import com.cloud.dc.dao.ClusterDaoImpl;
2929

30-
3130
@Configuration
3231
public class TestConfiguration {
3332
@Bean

server/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
4343
protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByKeywordSearch;
4444
protected final SearchBuilder<ServiceOfferingVO> PublicServiceOfferingSearch;
4545

46-
protected ServiceOfferingDaoImpl() {
46+
public ServiceOfferingDaoImpl() {
4747
super();
4848

4949
UniqueNameSearch = createSearchBuilder();

server/src/com/cloud/tags/dao/ResourceTagsDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class ResourceTagsDaoImpl extends GenericDaoBase<ResourceTagVO, Long> implements ResourceTagDao{
3535
final SearchBuilder<ResourceTagVO> AllFieldsSearch;
3636

37-
protected ResourceTagsDaoImpl() {
37+
public ResourceTagsDaoImpl() {
3838
AllFieldsSearch = createSearchBuilder();
3939
AllFieldsSearch.and("resourceId", AllFieldsSearch.entity().getResourceId(), Op.EQ);
4040
AllFieldsSearch.and("uuid", AllFieldsSearch.entity().getResourceUuid(), Op.EQ);

server/src/com/cloud/user/dao/AccountDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class AccountDaoImpl extends GenericDaoBase<AccountVO, Long> implements A
5555
protected final SearchBuilder<AccountVO> CleanupForDisabledAccountsSearch;
5656
protected final SearchBuilder<AccountVO> NonProjectAccountSearch;
5757

58-
protected AccountDaoImpl() {
58+
public AccountDaoImpl() {
5959
AllFieldsSearch = createSearchBuilder();
6060
AllFieldsSearch.and("accountName", AllFieldsSearch.entity().getAccountName(), SearchCriteria.Op.EQ);
6161
AllFieldsSearch.and("domainId", AllFieldsSearch.entity().getDomainId(), SearchCriteria.Op.EQ);

server/src/com/cloud/user/dao/UserAccountDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class UserAccountDaoImpl extends GenericDaoBase<UserAccountVO, Long> impl
3232

3333
protected final SearchBuilder<UserAccountVO> userAccountSearch;
3434

35-
protected UserAccountDaoImpl() {
35+
public UserAccountDaoImpl() {
3636
userAccountSearch = createSearchBuilder();
3737
userAccountSearch.and("apiKey", userAccountSearch.entity().getApiKey(), SearchCriteria.Op.EQ);
3838
userAccountSearch.done();

server/src/com/cloud/vm/dao/NicDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
4242
final GenericSearchBuilder<NicVO, Integer> CountBy;
4343

4444

45-
protected NicDaoImpl() {
45+
public NicDaoImpl() {
4646
super();
4747

4848
AllFieldsSearch = createSearchBuilder();

server/src/com/cloud/vm/dao/UserVmDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
116116
@Inject protected UserVmDetailsDao _detailsDao;
117117
@Inject protected NicDao _nicDao;
118118

119-
protected UserVmDaoImpl() {
119+
public UserVmDaoImpl() {
120120
}
121121

122122
@PostConstruct

server/src/com/cloud/vm/dao/UserVmDetailsDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class UserVmDetailsDaoImpl extends GenericDaoBase<UserVmDetailVO, Long> i
3636
protected final SearchBuilder<UserVmDetailVO> VmSearch;
3737
protected final SearchBuilder<UserVmDetailVO> DetailSearch;
3838

39-
protected UserVmDetailsDaoImpl() {
39+
public UserVmDetailsDaoImpl() {
4040
VmSearch = createSearchBuilder();
4141
VmSearch.and("vmId", VmSearch.entity().getVmId(), SearchCriteria.Op.EQ);
4242
VmSearch.done();
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<beans xmlns="http://www.springframework.org/schema/beans"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xmlns:context="http://www.springframework.org/schema/context"
22+
xmlns:tx="http://www.springframework.org/schema/tx"
23+
xmlns:aop="http://www.springframework.org/schema/aop"
24+
xsi:schemaLocation="http://www.springframework.org/schema/beans
25+
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
26+
http://www.springframework.org/schema/tx
27+
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
28+
http://www.springframework.org/schema/aop
29+
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
30+
http://www.springframework.org/schema/context
31+
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
32+
33+
<context:annotation-config />
34+
<context:component-scan base-package="com.cloud.usage" />
35+
36+
<!--
37+
@DB support
38+
-->
39+
<aop:config proxy-target-class="true">
40+
<aop:aspect id="dbContextBuilder" ref="transactionContextBuilder">
41+
<aop:pointcut id="captureAnyMethod"
42+
expression="execution(* *(..))"
43+
/>
44+
<aop:around pointcut-ref="captureAnyMethod" method="AroundAnyMethod"/>
45+
</aop:aspect>
46+
47+
</aop:config>
48+
49+
<bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" />
50+
<bean id="ComponentContext" class="com.cloud.utils.component.ComponentContext" />
51+
<bean id="UsageServerConfig" class="com.cloud.usage.UsageServerComponentConfig" />
52+
53+
</beans>

usage/src/com/cloud/usage/UsageManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
144144
final Class<?> c = UsageServer.class;
145145
m_version = c.getPackage().getImplementationVersion();
146146
if (m_version == null) {
147-
throw new CloudRuntimeException("Unable to find the implementation version of this usage server");
147+
// TODO
148+
// throw new CloudRuntimeException("Unable to find the implementation version of this usage server");
148149
}
149150

150151
if (s_logger.isInfoEnabled()) {

0 commit comments

Comments
 (0)