Make nonoss build work under Spring
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/767f54cc Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/767f54cc Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/767f54cc Branch: refs/heads/master Commit: 767f54cc9a30b45dff29cb3eba3ee650fbf7290d Parents: 2b67fc8 Author: Kelven Yang <[email protected]> Authored: Fri Jan 25 17:18:36 2013 -0800 Committer: Kelven Yang <[email protected]> Committed: Fri Jan 25 17:18:36 2013 -0800 ---------------------------------------------------------------------- client/tomcatconf/nonossComponentContext.xml.in | 37 ++++++++++++++- .../vmware/src/com/cloud/ha/VmwareFencer.java | 7 ++- .../configuration/dao/ConfigurationDaoImpl.java | 10 ++++ .../src/com/cloud/server/ManagementServerImpl.java | 3 +- 4 files changed, 50 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/767f54cc/client/tomcatconf/nonossComponentContext.xml.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in index 1f1dd7a..7dbb549 100644 --- a/client/tomcatconf/nonossComponentContext.xml.in +++ b/client/tomcatconf/nonossComponentContext.xml.in @@ -1,3 +1,35 @@ +<!-- + 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. +--> + +<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"> <!-- @@ -263,8 +295,9 @@ <bean id="configurationDaoImpl" class="com.cloud.configuration.dao.ConfigurationDaoImpl"> <property name="configParams"> <map> - <entry key="premium" value="1" /> + <entry key="premium" value="true" /> </map> </property> </bean> - \ No newline at end of file + +</beans> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/767f54cc/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java b/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java index 13cf065..b7f244a 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java @@ -21,8 +21,6 @@ import java.util.Map; import javax.ejb.Local; import javax.naming.ConfigurationException; -import org.springframework.stereotype.Component; - import com.cloud.host.HostVO; import com.cloud.vm.VMInstanceVO; @@ -41,7 +39,6 @@ public class VmwareFencer implements FenceBuilder { @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { - _name = name; return true; } @@ -49,6 +46,10 @@ public class VmwareFencer implements FenceBuilder { public String getName() { return _name; } + + public void setName(String name) { + _name = name; + } @Override public boolean start() { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/767f54cc/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java b/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java index 91cb29b..b905a8b 100644 --- a/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java +++ b/server/src/com/cloud/configuration/dao/ConfigurationDaoImpl.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.PostConstruct; import javax.ejb.Local; import javax.naming.ConfigurationException; @@ -62,6 +63,15 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String return _premium; } + @PostConstruct + void initComponent() { + try { + configure(this.getClass().getSimpleName(), this.getConfigParams()); + } catch (ConfigurationException e) { + s_logger.warn("Self configuration failed", e); + } + } + @Override public void invalidateCache() { _configs = null; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/767f54cc/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 e9d2e23..556f3f0 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -446,11 +446,10 @@ public class ManagementServerImpl implements ManagementServer { Map<String, GenericDaoBase> daos = ComponentContext.getApplicationContext().getBeansOfType( GenericDaoBase.class); - Map<String, Object> params = new HashMap<String, Object>(); for (GenericDaoBase dao : daos.values()) { try { s_logger.info("Starting dao " + ComponentContext.getTargetClass(dao).getName()); - dao.configure(dao.getClass().getSimpleName(), params); + dao.configure(dao.getClass().getSimpleName(), dao.getConfigParams()); } catch (Exception e) { s_logger.error("Problems with running checker:" + ComponentContext.getTargetClass(dao).getName(), e); System.exit(1);
