You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/08/09 00:01:47 UTC
[4/5] Revert "Reverting the range of commits that broke the build"
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotAdmin.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotAdmin.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotAdmin.java
new file mode 100644
index 0000000..b4d3773
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotAdmin.java
@@ -0,0 +1,36 @@
+// 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 org.apache.cloudstack.framework.config;
+
+import java.util.List;
+
+/**
+ * Administrative interface to ConfigDepot
+ *
+ */
+public interface ConfigDepotAdmin {
+ /**
+ * Create configurations if there are new config parameters.
+ * Update configurations if the parameter settings have been changed.
+ * All configurations that have been updated/created will have the same timestamp in the updated field.
+ * All previous configurations that should be obsolete will have a null updated field.
+ * @see Configuration
+ */
+ void populateConfigurations();
+
+ List<String> getComponentsInDepot();
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java
new file mode 100644
index 0000000..b2be0f2
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepotImpl.java
@@ -0,0 +1,106 @@
+// 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 org.apache.cloudstack.framework.config;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
+import com.cloud.utils.db.EntityManager;
+
+/**
+ * ConfigDepotImpl implements the ConfigDepot and ConfigDepotAdmin interface.
+ * Its functionalities include:
+ * - Control how dynamic config values are cached and refreshed.
+ * - Control how scoped config values are stored.
+ * - Gather all of the Configurable interfaces and insert their config
+ * variables into the config table.
+ * - Hide the data source where configs are stored and retrieved.
+ *
+ * When dealing with this class, we must be very careful on cluster situations.
+ *
+ * TODO:
+ * - Move the rest of the changes to the config table to here.
+ * - Implement ScopedConfigValue
+ * - Move the code to set scoped configuration values to here.
+ * - Add the code to mark the rows in configuration table without
+ * the corresponding keys to be null.
+ * - Move all of the configurations to using ConfigDepot
+ * - Completely eliminate Config.java
+ * - Figure out the correct categories.
+ *
+ */
+class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
+ @Inject
+ EntityManager _entityMgr;
+
+ @Inject
+ ConfigurationDao _configDao;
+
+ @Inject
+ List<Configurable> _configurables;
+
+ public ConfigDepotImpl() {
+ }
+
+ @Override
+ public <T> ConfigValue<T> get(ConfigKey<T> config) {
+ return new ConfigValue<T>(_entityMgr, config);
+ }
+
+ @Override
+ public <T> ScopedConfigValue<T> getScopedValue(ConfigKey<T> config) {
+ assert (config.scope() != null) : "Did you notice the configuration you're trying to retrieve is not scoped?";
+ return new ScopedConfigValue<T>(_entityMgr, config);
+ }
+
+ @Override
+ public void populateConfigurations() {
+ Date date = new Date();
+ for (Configurable configurable : _configurables) {
+ for (ConfigKey<?> key : configurable.getConfigKeys()) {
+ ConfigurationVO vo = _configDao.findById(key.key());
+ if (vo == null) {
+ vo = new ConfigurationVO(configurable.getConfigComponentName(), key);
+ vo.setUpdated(date);
+ _configDao.persist(vo);
+ } else {
+ if (vo.isDynamic() != key.isDynamic() ||
+ !vo.getDescription().equals(key.description()) ||
+ ((vo.getDefaultValue() != null && key.defaultValue() == null) ||
+ (vo.getDefaultValue() == null && key.defaultValue() != null) ||
+ !vo.getDefaultValue().equals(key.defaultValue()))) {
+ vo.setDynamic(key.isDynamic());
+ vo.setDescription(key.description());
+ vo.setDefaultValue(key.defaultValue());
+ vo.setUpdated(date);
+ _configDao.persist(vo);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public List<String> getComponentsInDepot() {
+ return new ArrayList<String>();
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java
new file mode 100644
index 0000000..cef226c
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java
@@ -0,0 +1,84 @@
+// 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 org.apache.cloudstack.framework.config;
+
+import com.cloud.org.Grouping;
+
+/**
+ * ConfigKey supplants the original Config.java. It is just a class
+ * declaration where others can declare their config variables.
+ *
+ */
+public class ConfigKey<T> {
+
+ private final String _category;
+
+ public String category() {
+ return _category;
+ }
+
+ public Class<T> type() {
+ return _type;
+ }
+
+ public String key() {
+ return _name;
+ }
+
+ public String defaultValue() {
+ return _defaultValue;
+ }
+
+ public String description() {
+ return _description;
+ }
+
+ public Class<? extends Grouping> scope() {
+ return _scope;
+ }
+
+ public boolean isDynamic() {
+ return _isDynamic;
+ }
+
+ @Override
+ public String toString() {
+ return _name;
+ }
+
+ private final Class<T> _type;
+ private final String _name;
+ private final String _defaultValue;
+ private final String _description;
+ private final Class<? extends Grouping> _scope; // Parameter can be at different levels (Zone/cluster/pool/account), by default every parameter is at global
+ private final boolean _isDynamic;
+
+ public ConfigKey(Class<T> type, String name, String category, String defaultValue, String description, boolean isDynamic,
+ Class<? extends Grouping> scope) {
+ _category = category;
+ _type = type;
+ _name = name;
+ _defaultValue = defaultValue;
+ _description = description;
+ _scope = scope;
+ _isDynamic = isDynamic;
+ }
+
+ public ConfigKey(Class<T> type, String name, String category, String defaultValue, String description, boolean isDynamic) {
+ this(type, name, category, defaultValue, description, isDynamic, null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
new file mode 100644
index 0000000..0cfc61a
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
@@ -0,0 +1,78 @@
+// 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 org.apache.cloudstack.framework.config;
+
+import org.apache.cloudstack.config.Configuration;
+
+import com.cloud.utils.db.EntityManager;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+/**
+ * This is a match set to ConfigKey.
+ *
+ * TODO: When we create a framework project for configuration, this should be
+ * moved there.
+ */
+public class ConfigValue<T> {
+
+ ConfigKey<T> _config;
+ EntityManager _entityMgr;
+ Number _multiplier;
+ T _value;
+
+ public ConfigValue(EntityManager entityMgr, ConfigKey<T> config) {
+ _entityMgr = entityMgr;
+ _config = config;
+ _multiplier = 1;
+ }
+
+ public ConfigKey<T> getConfigKey() {
+ return _config;
+ }
+
+ public ConfigValue<T> setMultiplier(Number multiplier) { // Convience method
+ _multiplier = multiplier;
+ return this;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T value() {
+ if (_value == null || _config.isDynamic()) {
+ Configuration vo = _entityMgr.findById(Configuration.class, _config.key());
+ String value = vo != null ? vo.getValue() : _config.defaultValue();
+
+ Class<T> type = _config.type();
+ if (type.isAssignableFrom(Boolean.class)) {
+ _value = (T)Boolean.valueOf(value);
+ } else if (type.isAssignableFrom(Integer.class)) {
+ _value = (T)new Integer((Integer.parseInt(value) * _multiplier.intValue()));
+ } else if (type.isAssignableFrom(Long.class)) {
+ _value = (T)new Long(Long.parseLong(value) * _multiplier.longValue());
+ } else if (type.isAssignableFrom(Short.class)) {
+ _value = (T)new Short(Short.parseShort(value));
+ } else if (type.isAssignableFrom(String.class)) {
+ _value = (T)value;
+ } else if (type.isAssignableFrom(Float.class)) {
+ _value = (T)new Float(Float.parseFloat(value) * _multiplier.floatValue());
+ } else {
+ throw new CloudRuntimeException("Unsupported data type for config values: " + type);
+ }
+ }
+
+ return _value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/Configurable.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/Configurable.java b/framework/config/src/org/apache/cloudstack/framework/config/Configurable.java
new file mode 100644
index 0000000..f99e8a1
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/Configurable.java
@@ -0,0 +1,32 @@
+// 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 org.apache.cloudstack.framework.config;
+
+/**
+ * Configurable can be implemented by components to insert their own
+ * configuration keys.
+ *
+ * CloudStack will gather all of these configurations at startup and insert
+ * them into the configuration table.
+ *
+ */
+public interface Configurable {
+
+ String getConfigComponentName();
+
+ ConfigKey<?>[] getConfigKeys();
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java
new file mode 100644
index 0000000..0cc1019
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigurationVO.java
@@ -0,0 +1,175 @@
+// 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 org.apache.cloudstack.framework.config;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.config.Configuration;
+
+import com.cloud.utils.crypt.DBEncryptionUtil;
+
+@Entity
+@Table(name = "configuration")
+public class ConfigurationVO implements Configuration {
+ @Column(name = "instance")
+ private String instance;
+
+ @Column(name = "component")
+ private String component;
+
+ @Id
+ @Column(name = "name")
+ private String name;
+
+ @Column(name = "value", length = 4095)
+ private String value;
+
+ @Column(name = "default_value", length = 4095)
+ private String defaultValue;
+
+ @Column(name = "description", length = 1024)
+ private String description;
+
+ @Column(name = "category")
+ private String category;
+
+ @Column(name = "is_dynamic")
+ private boolean dynamic;
+
+ @Column(name = "scope")
+ private String scope;
+
+ @Column(name = "updated")
+ @Temporal(value = TemporalType.TIMESTAMP)
+ private Date updated;
+
+ protected ConfigurationVO() {
+ }
+
+ public ConfigurationVO(String category, String instance, String component, String name, String value, String description) {
+ this.category = category;
+ this.instance = instance;
+ this.component = component;
+ this.name = name;
+ this.value = value;
+ this.description = description;
+ }
+
+ public ConfigurationVO(String component, ConfigKey<?> key) {
+ this(key.category(), "DEFAULT", component, key.key(), key.defaultValue(), key.description());
+ defaultValue = key.defaultValue();
+ dynamic = key.isDynamic();
+ scope = key.scope() != null ? key.scope().getName() : null;
+ }
+
+ @Override
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ @Override
+ public String getInstance() {
+ return instance;
+ }
+
+ public void setInstance(String instance) {
+ this.instance = instance;
+ }
+
+ @Override
+ public String getComponent() {
+ return component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getValue() {
+ return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public String getScope() {
+ return scope;
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return dynamic;
+ }
+
+ public void setDynamic(boolean dynamic) {
+ this.dynamic = dynamic;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ @Override
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/ScopedConfigValue.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ScopedConfigValue.java b/framework/config/src/org/apache/cloudstack/framework/config/ScopedConfigValue.java
new file mode 100644
index 0000000..4631521
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ScopedConfigValue.java
@@ -0,0 +1,43 @@
+// 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 org.apache.cloudstack.framework.config;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.Pod;
+import com.cloud.org.Cluster;
+import com.cloud.org.Grouping;
+import com.cloud.utils.db.EntityManager;
+
+public class ScopedConfigValue<T> extends ConfigValue<T> {
+ public T getValueForScope(long scopeId) {
+ // TODO: In order to complete this the details for zone, pod, cluster
+ // needs to have interfaces. Then you can use the EntityManager to
+ // retrieve those information.
+ Class<? extends Grouping> scope = _config.scope();
+ if (scope == DataCenter.class) {
+ } else if (scope == Pod.class) {
+
+ } else if (scope == Cluster.class) {
+
+ }
+ return null;
+ }
+
+ protected ScopedConfigValue(EntityManager entityMgr, ConfigKey<T> key) {
+ super(entityMgr, key);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java
new file mode 100644
index 0000000..70fdb2e
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDao.java
@@ -0,0 +1,70 @@
+// 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 org.apache.cloudstack.framework.config.dao;
+
+import java.util.Map;
+import java.util.List;
+
+import org.apache.cloudstack.framework.config.ConfigurationVO;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface ConfigurationDao extends GenericDao<ConfigurationVO, String> {
+
+ /**
+ *
+ * 1. params passed in.
+ * 2. configuration for the instance.
+ * 3. configuration for the DEFAULT instance.
+ *
+ * @param params parameters from the components.xml which will override the database values.
+ * @return a consolidated look at the configuration parameters.
+ */
+ public Map<String, String> getConfiguration(String instance, Map<String, ? extends Object> params);
+
+ public Map<String, String> getConfiguration(Map<String, ? extends Object> params);
+
+ public Map<String, String> getConfiguration();
+
+ /**
+ * Updates a configuration value
+ * @param value the new value
+ * @return true if success, false if failure
+ */
+ public boolean update(String name, String value);
+
+ /**
+ * Gets the value for the specified configuration name
+ * @return value
+ */
+ public String getValue(String name);
+
+ public String getValueAndInitIfNotExist(String name, String category, String initValue);
+
+
+ /**
+ * returns whether or not this is a premium configuration
+ * @return true if premium configuration, false otherwise
+ */
+ boolean isPremium();
+
+ ConfigurationVO findByName(String name);
+
+ boolean update(String name, String category, String value);
+
+ void invalidateCache();
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
new file mode 100644
index 0000000..c677fa9
--- /dev/null
+++ b/framework/config/src/org/apache/cloudstack/framework/config/dao/ConfigurationDaoImpl.java
@@ -0,0 +1,206 @@
+// 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 org.apache.cloudstack.framework.config.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import org.apache.cloudstack.framework.config.ConfigurationVO;
+
+import com.cloud.utils.component.ComponentLifecycle;
+import com.cloud.utils.crypt.DBEncryptionUtil;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={ConfigurationDao.class})
+public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String> implements ConfigurationDao {
+ private static final Logger s_logger = Logger.getLogger(ConfigurationDaoImpl.class);
+ private Map<String, String> _configs = null;
+ private boolean _premium;
+
+ final SearchBuilder<ConfigurationVO> InstanceSearch;
+ final SearchBuilder<ConfigurationVO> NameSearch;
+
+ public static final String UPDATE_CONFIGURATION_SQL = "UPDATE configuration SET value = ? WHERE name = ?";
+
+ public ConfigurationDaoImpl () {
+ InstanceSearch = createSearchBuilder();
+ InstanceSearch.and("instance", InstanceSearch.entity().getInstance(), SearchCriteria.Op.EQ);
+
+ NameSearch = createSearchBuilder();
+ NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
+ setRunLevel(ComponentLifecycle.RUN_LEVEL_SYSTEM_BOOTSTRAP);
+ }
+
+ @Override
+ public boolean isPremium() {
+ return _premium;
+ }
+
+ @Override
+ public void invalidateCache() {
+ _configs = null;
+ }
+
+ @Override
+ public Map<String, String> getConfiguration(String instance, Map<String, ? extends Object> params) {
+ if (_configs == null) {
+ _configs = new HashMap<String, String>();
+
+ SearchCriteria<ConfigurationVO> sc = InstanceSearch.create();
+ sc.setParameters("instance", "DEFAULT");
+
+ List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
+
+ for (ConfigurationVO config : configurations) {
+ if (config.getValue() != null)
+ _configs.put(config.getName(), config.getValue());
+ }
+
+ if(!"DEFAULT".equals(instance)){
+ //Default instance params are already added, need not add again
+ sc = InstanceSearch.create();
+ sc.setParameters("instance", instance);
+
+ configurations = listIncludingRemovedBy(sc);
+
+ for (ConfigurationVO config : configurations) {
+ if (config.getValue() != null)
+ _configs.put(config.getName(), config.getValue());
+ }
+ }
+
+ }
+
+ mergeConfigs(_configs, params);
+ return _configs;
+ }
+
+ @Override
+ public Map<String, String> getConfiguration(Map<String, ? extends Object> params) {
+ return getConfiguration("DEFAULT", params);
+ }
+
+ @Override
+ public Map<String, String> getConfiguration() {
+ return getConfiguration("DEFAULT", new HashMap<String, Object>());
+ }
+
+ protected void mergeConfigs(Map<String, String> dbParams, Map<String, ? extends Object> xmlParams) {
+ for (Map.Entry<String, ? extends Object> param : xmlParams.entrySet()) {
+ dbParams.put(param.getKey(), (String)param.getValue());
+ }
+ }
+
+ @Override
+ public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+ super.configure(name, params);
+
+ Object premium = params.get("premium");
+ _premium = (premium != null) && ((String) premium).equals("true");
+
+ return true;
+ }
+
+ //Use update method with category instead
+ @Override @Deprecated
+ public boolean update(String name, String value) {
+ Transaction txn = Transaction.currentTxn();
+ try {
+ PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
+ stmt.setString(1, value);
+ stmt.setString(2, name);
+ stmt.executeUpdate();
+ return true;
+ } catch (Exception e) {
+ s_logger.warn("Unable to update Configuration Value", e);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean update(String name, String category, String value) {
+ Transaction txn = Transaction.currentTxn();
+ try {
+ value = ("Hidden".equals(category) || "Secure".equals(category)) ? DBEncryptionUtil.encrypt(value) : value;
+ PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
+ stmt.setString(1, value);
+ stmt.setString(2, name);
+ stmt.executeUpdate();
+ return true;
+ } catch (Exception e) {
+ s_logger.warn("Unable to update Configuration Value", e);
+ }
+ return false;
+ }
+
+ @Override
+ public String getValue(String name) {
+ ConfigurationVO config = findByName(name);
+ return (config == null) ? null : config.getValue();
+ }
+
+ @Override
+ @DB
+ public String getValueAndInitIfNotExist(String name, String category, String initValue) {
+ String returnValue = initValue;
+ try {
+ ConfigurationVO config = findByName(name);
+ if (config != null) {
+ if (config.getValue() != null) {
+ returnValue = config.getValue();
+ } else {
+ update(name, category, initValue);
+ }
+ } else {
+ if (category.equals("Hidden") || category.equals("Secure")) {
+ initValue = DBEncryptionUtil.encrypt(initValue);
+ }
+ ConfigurationVO newConfig = new ConfigurationVO(category, "DEFAULT", "management-server", name, initValue, "");
+ persist(newConfig);
+ }
+ return returnValue;
+ } catch (Exception e) {
+ s_logger.warn("Unable to update Configuration Value", e);
+ throw new CloudRuntimeException("Unable to initialize configuration variable: " + name);
+
+ }
+ }
+
+ @Override
+ public ConfigurationVO findByName(String name) {
+ SearchCriteria<ConfigurationVO> sc = NameSearch.create();
+ sc.setParameters("name", name);
+ return findOneIncludingRemovedBy(sc);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java
----------------------------------------------------------------------
diff --git a/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java b/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java
new file mode 100644
index 0000000..782b3c7
--- /dev/null
+++ b/framework/config/test/org/apache/cloudstack/framework/config/ConfigDepotAdminTest.java
@@ -0,0 +1,131 @@
+// 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 org.apache.cloudstack.framework.config;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+
+import javax.inject.Inject;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.core.type.filter.TypeFilter;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.test.utils.SpringUtils;
+
+import com.cloud.utils.component.ComponentContext;
+import com.cloud.utils.db.EntityManager;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
+public class ConfigDepotAdminTest {
+ private final ConfigKey<Integer> DynamicIntCK = new ConfigKey<Integer>(Integer.class, "dynIntKey", "Advance", "10", "Test Key", true);
+ private final ConfigKey<Integer> StaticIntCK = new ConfigKey<Integer>(Integer.class, "statIntKey", "Advance", "10", "Test Key", false);
+
+ @Inject
+ Configurable configurable;
+
+ @Inject
+ ConfigDepot _configDepot;
+
+ @Inject
+ ConfigDepotAdmin _depotAdmin;
+
+ @Inject
+ EntityManager _entityMgr;
+
+ @Inject
+ ConfigurationDao _configDao;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ ComponentContext.initComponentsLifeCycle(); // NOTE #3
+ }
+
+ @Test
+ public void testAutoPopulation() {
+ ConfigurationVO dynamicIntCV = new ConfigurationVO("UnitTestComponent", DynamicIntCK);
+ dynamicIntCV.setValue("100");
+ ConfigurationVO staticIntCV = new ConfigurationVO("UnitTestComponent", StaticIntCK);
+ dynamicIntCV.setValue("200");
+
+ when(configurable.getConfigComponentName()).thenReturn("UnitTestComponent");
+ when(configurable.getConfigKeys()).thenReturn(new ConfigKey<?>[] {DynamicIntCK, StaticIntCK});
+ when(_entityMgr.findById(org.apache.cloudstack.config.Configuration.class, DynamicIntCK.key())).thenReturn(dynamicIntCV);
+ when(_entityMgr.findById(org.apache.cloudstack.config.Configuration.class, StaticIntCK.key())).thenReturn(staticIntCV);
+ when(_configDao.findById(StaticIntCK.key())).thenReturn(null);
+ when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
+ when(_configDao.persist(any(ConfigurationVO.class))).thenReturn(dynamicIntCV);
+
+ _depotAdmin.populateConfigurations();
+
+ // This is once because DynamicIntCK is returned.
+ verify(_configDao, times(1)).persist(any(ConfigurationVO.class));
+
+ when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
+ _depotAdmin.populateConfigurations();
+ // This is two because DynamicIntCK also returns null.
+ verify(_configDao, times(2)).persist(any(ConfigurationVO.class));
+ }
+
+ @Configuration
+ @ComponentScan(basePackageClasses = {ConfigDepotImpl.class}, includeFilters = {@Filter(value = TestConfiguration.Library.class, type = FilterType.CUSTOM)}, useDefaultFilters = false)
+ static class TestConfiguration extends SpringUtils.CloudStackTestConfiguration {
+ @Bean
+ public Configurable configurable() {
+ return mock(Configurable.class);
+ }
+
+ @Bean
+ public EntityManager entityMgr() {
+ return mock(EntityManager.class);
+ }
+
+ @Bean
+ public ConfigurationDao configurationDao() {
+ return mock(ConfigurationDao.class);
+ }
+
+ public static class Library implements TypeFilter {
+ @Override
+ public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
+ ComponentScan cs = TestConfiguration.class.getAnnotation(ComponentScan.class);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/db/pom.xml
----------------------------------------------------------------------
diff --git a/framework/db/pom.xml b/framework/db/pom.xml
index 77f618d..5af00a0 100644
--- a/framework/db/pom.xml
+++ b/framework/db/pom.xml
@@ -25,7 +25,7 @@
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
+ <artifactId>ehcache-core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index f593c38..94e5374 100755
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -32,8 +32,10 @@ import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
@@ -77,9 +79,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.Ip;
import com.cloud.utils.net.NetUtils;
-import edu.emory.mathcs.backport.java.util.Arrays;
-import edu.emory.mathcs.backport.java.util.Collections;
-
/**
* GenericDaoBase is a simple way to implement DAOs. It DOES NOT
* support the full EJB3 spec. It borrows some of the annotations from
@@ -1266,6 +1265,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
return update(ub, sc, rows);
}
+ @Override
@DB(txn=false)
public int update(final T entity, final SearchCriteria<T> sc) {
final UpdateBuilder ub = getUpdateBuilder(entity);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/jobs/pom.xml
----------------------------------------------------------------------
diff --git a/framework/jobs/pom.xml b/framework/jobs/pom.xml
index b2ef8e7..f491c60 100644
--- a/framework/jobs/pom.xml
+++ b/framework/jobs/pom.xml
@@ -52,5 +52,10 @@
<artifactId>cloud-framework-cluster</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 9b12a57..38377ee 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -20,6 +20,7 @@ package org.apache.cloudstack.framework.jobs.impl;
import java.io.File;
import java.io.FileInputStream;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -37,10 +38,10 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.config.ConfigDepot;
-import org.apache.cloudstack.config.ConfigKey;
-import org.apache.cloudstack.config.ConfigValue;
-import org.apache.cloudstack.config.Configurable;
+import org.apache.cloudstack.framework.config.ConfigDepot;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.ConfigValue;
+import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.jobs.AsyncJob;
import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
import org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext;
@@ -76,13 +77,11 @@ import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.exception.ExceptionUtil;
import com.cloud.utils.mgmt.JmxUtil;
-import edu.emory.mathcs.backport.java.util.Collections;
-
public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, ClusterManagerListener, Configurable {
// Advanced
- private static final ConfigKey<Long> JobExpireMinutes = new ConfigKey<Long>(Long.class, "job.expire.minutes", "Advanced", AsyncJobManager.class, "1440",
+ private static final ConfigKey<Long> JobExpireMinutes = new ConfigKey<Long>(Long.class, "job.expire.minutes", "Advanced", "1440",
"Time (in minutes) for async-jobs to be kept in system", true, null);
- private static final ConfigKey<Long> JobCancelThresholdMinutes = new ConfigKey<Long>(Long.class, "job.cancel.threshold.minutes", "Advanced", AsyncJobManager.class,
+ private static final ConfigKey<Long> JobCancelThresholdMinutes = new ConfigKey<Long>(Long.class, "job.cancel.threshold.minutes", "Advanced",
"60", "Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", true, null);
private static final Logger s_logger = Logger.getLogger(AsyncJobManagerImpl.class);
@@ -115,6 +114,11 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
private ExecutorService _executor;
@Override
+ public String getConfigComponentName() {
+ return AsyncJobManager.class.getSimpleName();
+ }
+
+ @Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {JobExpireMinutes, JobCancelThresholdMinutes};
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/framework/pom.xml
----------------------------------------------------------------------
diff --git a/framework/pom.xml b/framework/pom.xml
index f322f70..1764076 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -34,7 +34,8 @@
<module>rest</module>
<module>events</module>
<module>jobs</module>
- <module>cluster</module>
- <module>db</module>
+ <module>cluster</module>
+ <module>db</module>
+ <module>config</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
index 47c615a..79fdef2 100644
--- a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
+++ b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
@@ -27,11 +27,12 @@ import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.messagebus.MessageSubscriber;
+
import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java
----------------------------------------------------------------------
diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java
index 0fdf391..3d79fd5 100644
--- a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java
+++ b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java
@@ -27,12 +27,12 @@ import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ApiLimitResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.ratelimit.ApiRateLimitService;
import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.user.Account;
import javax.inject.Inject;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java
----------------------------------------------------------------------
diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java
index 6add147..d0e177a 100644
--- a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java
+++ b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java
@@ -37,10 +37,10 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.ratelimit.ApiRateLimitService;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
index 7d1b43a..e257c70 100644
--- a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
+++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.ratelimit;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
@@ -33,15 +34,16 @@ import org.apache.cloudstack.api.ApiConstants.LDAPParams;
import org.apache.cloudstack.api.command.admin.ratelimit.ResetApiLimitCmd;
import org.apache.cloudstack.api.command.user.ratelimit.GetApiLimitCmd;
import org.apache.cloudstack.api.response.ApiLimitResponse;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.RequestLimitException;
import com.cloud.user.Account;
import com.cloud.user.AccountService;
import com.cloud.user.User;
import com.cloud.utils.component.AdapterBase;
+
import org.springframework.stereotype.Component;
@Component
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
----------------------------------------------------------------------
diff --git a/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
index 3c6cadf..8d31b9d 100644
--- a/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
+++ b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java
@@ -24,13 +24,14 @@ import java.util.concurrent.Executors;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.response.ApiLimitResponse;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl;
+
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.exception.RequestLimitException;
import com.cloud.user.Account;
import com.cloud.user.AccountService;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java b/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java
index 15d553e..3314463 100755
--- a/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java
+++ b/plugins/dedicated-resources/src/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java
@@ -43,12 +43,12 @@ import org.apache.cloudstack.api.response.DedicateHostResponse;
import org.apache.cloudstack.api.response.DedicatePodResponse;
import org.apache.cloudstack.api.response.DedicateZoneResponse;
import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.DedicatedResourceVO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/dedicated-resources/test/org/apache/cloudstack/dedicated/manager/DedicatedApiUnitTest.java
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/test/org/apache/cloudstack/dedicated/manager/DedicatedApiUnitTest.java b/plugins/dedicated-resources/test/org/apache/cloudstack/dedicated/manager/DedicatedApiUnitTest.java
index 72890f2..34fdf1c 100644
--- a/plugins/dedicated-resources/test/org/apache/cloudstack/dedicated/manager/DedicatedApiUnitTest.java
+++ b/plugins/dedicated-resources/test/org/apache/cloudstack/dedicated/manager/DedicatedApiUnitTest.java
@@ -48,9 +48,9 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.test.utils.SpringUtils;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DedicatedResourceVO;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.dc.dao.DataCenterDao;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java b/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
index 73fd249..c0ce9d0 100644
--- a/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
+++ b/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
@@ -53,13 +53,13 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.test.utils.SpringUtils;
import com.cloud.capacity.CapacityManager;
import com.cloud.capacity.CapacityVO;
import com.cloud.capacity.dao.CapacityDao;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.ClusterDao;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
index 997d754..23eecd1 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
@@ -34,13 +34,14 @@ import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
import org.apache.log4j.Logger;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupRoutingCommand;
import com.cloud.baremetal.networkservice.BareMetalResourceBase;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.ClusterDao;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
index cf3ceed..a47dedd 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
@@ -25,8 +25,9 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
import com.cloud.capacity.CapacityManager;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.ClusterDetailsVO;
import com.cloud.dc.ClusterVO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
index 5e58abf..a814530 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
@@ -25,13 +25,15 @@ package com.cloud.baremetal.networkservice;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
-import org.apache.cloudstack.api.ApiConstants;
import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.ApiConstants;
+
import com.cloud.agent.IAgentControl;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.CheckNetworkAnswer;
@@ -66,7 +68,6 @@ import com.cloud.baremetal.manager.BaremetalManager;
import com.cloud.host.Host.Type;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.resource.ServerResource;
-import com.cloud.server.ManagementServer;
import com.cloud.utils.component.ComponentContext;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.exception.CloudRuntimeException;
@@ -79,8 +80,6 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
import com.cloud.vm.dao.VMInstanceDao;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-
@Local(value = ServerResource.class)
public class BareMetalResourceBase extends ManagerBase implements ServerResource {
private static final Logger s_logger = Logger.getLogger(BareMetalResourceBase.class);
@@ -134,8 +133,8 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
_cpuNum = Long.parseLong((String) params.get(ApiConstants.CPU_NUMBER));
} catch (NumberFormatException e) {
throw new ConfigurationException(String.format("Unable to parse number of CPU or memory capacity "
- + "or cpu capacity(cpu number = %1$s memCapacity=%2$s, cpuCapacity=%3$s", (String) params.get(ApiConstants.CPU_NUMBER),
- (String) params.get(ApiConstants.MEMORY), (String) params.get(ApiConstants.CPU_SPEED)));
+ + "or cpu capacity(cpu number = %1$s memCapacity=%2$s, cpuCapacity=%3$s", params.get(ApiConstants.CPU_NUMBER),
+ params.get(ApiConstants.MEMORY), params.get(ApiConstants.CPU_SPEED)));
}
_zone = (String) params.get("zone");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
index 4e9a11d..606ec59 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
@@ -37,6 +37,7 @@ import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
import org.apache.cloudstack.api.AddBaremetalPxeCmd;
import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
@@ -44,7 +45,6 @@ import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupPxeServerCommand;
import com.cloud.agent.api.routing.VmDataCommand;
import com.cloud.baremetal.database.BaremetalPxeVO;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.host.Host;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
index 15f618b..ba4f3d5 100755
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
@@ -39,10 +39,11 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UcsBladeResponse;
import org.apache.cloudstack.api.response.UcsManagerResponse;
import org.apache.cloudstack.api.response.UcsProfileResponse;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.ClusterDao;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
index d699a1e..dbc0ade 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
@@ -28,11 +28,13 @@ import java.util.UUID;
import javax.ejb.Local;
import javax.inject.Inject;
-
import com.cloud.agent.api.storage.CreateEntityDownloadURLCommand;
import com.cloud.host.Host;
import com.cloud.storage.Storage;
+
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.storage.to.VolumeObjectTO;
+
import org.apache.log4j.Logger;
import org.apache.cloudstack.storage.command.CopyCommand;
@@ -53,7 +55,6 @@ import com.cloud.agent.api.to.DataTO;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
index a13e59e..4a2c4e9 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
@@ -46,7 +46,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
private String guid;
@Column(name = "name")
- private String name;
+ private String vmwareDatacenterName;
@Column(name = "vcenter_host")
private String vCenterHost;
@@ -73,7 +73,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
@Override
public String getVmwareDatacenterName() {
- return name;
+ return vmwareDatacenterName;
}
@Override
@@ -105,7 +105,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
}
public void setVmwareDatacenterName(String name) {
- this.name = name;
+ this.vmwareDatacenterName = name;
}
public void setVcenterHost(String vCenterHost) {
@@ -141,7 +141,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
public VmwareDatacenterVO(String guid, String name, String vCenterHost, String user, String password) {
this.uuid = UUID.randomUUID().toString();
- this.name = name;
+ this.vmwareDatacenterName = name;
this.guid = guid;
this.vCenterHost = vCenterHost;
this.user = user;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 0df2cd3..1be105f 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -48,6 +48,7 @@ import org.apache.cloudstack.api.command.admin.zone.ListVmwareDcsCmd;
import org.apache.cloudstack.api.command.admin.zone.RemoveVmwareDcCmd;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.utils.identity.ManagementServerNode;
import com.cloud.agent.AgentManager;
@@ -59,7 +60,6 @@ import com.cloud.agent.api.Command;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupRoutingCommand;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.ClusterVSMMapVO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java b/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java
index d313bfa..016c54a 100644
--- a/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java
+++ b/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/VmwareDatacenterApiUnitTest.java
@@ -51,11 +51,11 @@ import org.apache.cloudstack.api.command.admin.zone.AddVmwareDcCmd;
import org.apache.cloudstack.api.command.admin.zone.RemoveVmwareDcCmd;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.test.utils.SpringUtils;
import com.cloud.agent.AgentManager;
import com.cloud.cluster.ClusterManager;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.ClusterDetailsVO;
import com.cloud.dc.ClusterVO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
index fd7274d..115f9f6 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java
@@ -28,9 +28,10 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
index 8df0caf..56c415a 100644
--- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
+++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java
@@ -38,6 +38,7 @@ import org.springframework.stereotype.Component;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import com.cloud.agent.AgentManager;
import com.cloud.agent.AgentManager.OnError;
@@ -50,7 +51,6 @@ import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.agent.manager.Commands;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.dc.DataCenterVO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
index 8ea4d61..fc2256b 100644
--- a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
+++ b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java
@@ -27,7 +27,9 @@ import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
+
import org.apache.log4j.Logger;
import com.cloud.agent.api.to.LoadBalancerTO;
@@ -43,7 +45,6 @@ import com.cloud.api.commands.ListF5LoadBalancersCmd;
import com.cloud.api.response.F5LoadBalancerResponse;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.DataCenterDao;
@@ -90,6 +91,7 @@ import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
+
import com.google.gson.Gson;
@Local(value = {NetworkElement.class, LoadBalancingServiceProvider.class, IpDeployer.class})
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
index 7f7c996..6b075db 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
@@ -28,6 +28,7 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
@@ -44,7 +45,6 @@ import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.agent.manager.Commands;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.DataCenterDao;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
index 4f03b27..52a204a 100644
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
@@ -18,8 +18,10 @@ package org.apache.cloudstack.internallbvmmgr;
import java.io.IOException;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.cloudstack.test.utils.SpringUtils;
+
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -31,7 +33,6 @@ import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
import com.cloud.agent.AgentManager;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.network.NetworkManager;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
index 85d6de6..7d99d4b 100644
--- a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
@@ -21,7 +21,6 @@ import com.cloud.api.commands.*;
import com.cloud.api.response.SrxFirewallResponse;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.dc.DataCenterVO;
@@ -50,12 +49,16 @@ import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
+
import org.apache.cloudstack.api.response.ExternalFirewallResponse;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
+
import org.apache.log4j.Logger;
import javax.ejb.Local;
import javax.inject.Inject;
+
import java.util.*;
@Local(value = {NetworkElement.class, FirewallServiceProvider.class,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java b/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
index b02e51d..85814ef 100644
--- a/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
+++ b/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
@@ -22,7 +22,6 @@ package com.cloud.network.element;
import com.cloud.agent.api.to.FirewallRuleTO;
import com.cloud.agent.api.to.PortForwardingRuleTO;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -54,6 +53,7 @@ import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.NicDao;
+
import com.midokura.midonet.client.MidonetApi;
import com.midokura.midonet.client.dto.DtoRule;
import com.midokura.midonet.client.resource.Bridge;
@@ -68,6 +68,9 @@ import com.midokura.midonet.client.resource.RouterPort;
import com.midokura.midonet.client.resource.Rule;
import com.midokura.midonet.client.resource.RuleChain;
import com.sun.jersey.core.util.MultivaluedMapImpl;
+
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -75,6 +78,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import javax.ws.rs.core.MultivaluedMap;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
index fa51fdc..d63b14f 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
@@ -28,8 +28,10 @@ import javax.ejb.Local;
import javax.inject.Inject;
import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
import org.apache.cloudstack.region.gslb.GslbServiceProvider;
+
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
@@ -51,7 +53,6 @@ import com.cloud.api.commands.ListNetscalerLoadBalancersCmd;
import com.cloud.api.response.NetscalerLoadBalancerResponse;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.dc.DataCenterIpAddressVO;
@@ -115,6 +116,7 @@ import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
+
import com.google.gson.Gson;
@Local(value = {NetworkElement.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class, GslbServiceProvider.class})
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
index 0e4f8fd..5c686c9 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java
@@ -59,7 +59,7 @@ import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
import com.cloud.user.Account;
import com.cloud.vm.ReservationContext;
-import edu.emory.mathcs.backport.java.util.Arrays;
+import java.util.Arrays;
public class NiciraNvpGuestNetworkGuruTest {
PhysicalNetworkDao physnetdao = mock (PhysicalNetworkDao.class);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
index d3db89f..36a807f 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java
@@ -30,12 +30,13 @@ import javax.persistence.EntityExistsException;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.manager.Commands;
import com.cloud.configuration.Config;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.OperationTimedoutException;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
index 6e1461a..64111ab 100644
--- a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
+++ b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/element/SspElement.java
@@ -32,15 +32,16 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.commands.AddSspCmd;
import org.apache.cloudstack.api.commands.DeleteSspCmd;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.network.dao.SspCredentialDao;
import org.apache.cloudstack.network.dao.SspCredentialVO;
import org.apache.cloudstack.network.dao.SspTenantDao;
import org.apache.cloudstack.network.dao.SspTenantVO;
import org.apache.cloudstack.network.dao.SspUuidDao;
import org.apache.cloudstack.network.dao.SspUuidVO;
+
import org.apache.log4j.Logger;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.ConcurrentOperationException;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5495f10b/plugins/network-elements/stratosphere-ssp/test/org/apache/cloudstack/network/element/SspElementTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/test/org/apache/cloudstack/network/element/SspElementTest.java b/plugins/network-elements/stratosphere-ssp/test/org/apache/cloudstack/network/element/SspElementTest.java
index 950592f..0fd709f 100644
--- a/plugins/network-elements/stratosphere-ssp/test/org/apache/cloudstack/network/element/SspElementTest.java
+++ b/plugins/network-elements/stratosphere-ssp/test/org/apache/cloudstack/network/element/SspElementTest.java
@@ -19,15 +19,16 @@ package org.apache.cloudstack.network.element;
import java.util.Arrays;
import java.util.HashMap;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.network.dao.SspCredentialDao;
import org.apache.cloudstack.network.dao.SspCredentialVO;
import org.apache.cloudstack.network.dao.SspTenantDao;
import org.apache.cloudstack.network.dao.SspUuidDao;
import org.apache.cloudstack.network.element.SspElement;
+
import org.junit.Before;
import org.junit.Test;
-import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.host.Host;
import com.cloud.host.HostVO;