cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [33/53] [abbrv] git commit: updated refs/heads/rbac to 33cd1ab
Date Wed, 22 Jan 2014 19:27:58 GMT
Removed "host" config parameter definition from ClusterManager interface as it got moved to
cloud-api package


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a0197006
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a0197006
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a0197006

Branch: refs/heads/rbac
Commit: a0197006ef813c1c506ba6ae8b189eb6f2e8a7b8
Parents: 747462b
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Tue Jan 21 11:13:35 2014 -0800
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Tue Jan 21 17:19:52 2014 -0800

----------------------------------------------------------------------
 .../cloudstack/api-config/module.properties     | 18 +++++++
 .../api-config/spring-api-config-context.xml    | 32 ++++++++++++
 .../config/ApiServiceConfiguration.java         |  5 +-
 .../src/com/cloud/cluster/ClusterManager.java   |  1 -
 .../com/cloud/cluster/ClusterManagerImpl.java   |  2 +-
 .../framework/config/ConfigDepot.java           |  2 +
 .../framework/config/impl/ConfigDepotImpl.java  | 52 ++++++++++++--------
 .../cloud/server/ConfigurationServerImpl.java   |  3 +-
 8 files changed, 91 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/api/resources/META-INF/cloudstack/api-config/module.properties
----------------------------------------------------------------------
diff --git a/api/resources/META-INF/cloudstack/api-config/module.properties b/api/resources/META-INF/cloudstack/api-config/module.properties
new file mode 100644
index 0000000..3b2a85d
--- /dev/null
+++ b/api/resources/META-INF/cloudstack/api-config/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=api-config
+parent=core

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/api/resources/META-INF/cloudstack/api-config/spring-api-config-context.xml
----------------------------------------------------------------------
diff --git a/api/resources/META-INF/cloudstack/api-config/spring-api-config-context.xml b/api/resources/META-INF/cloudstack/api-config/spring-api-config-context.xml
new file mode 100644
index 0000000..2cd1266
--- /dev/null
+++ b/api/resources/META-INF/cloudstack/api-config/spring-api-config-context.xml
@@ -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.
+-->
+<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: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/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"
+                      >
+
+    <bean id="apiServiceConfiguration" class="org.apache.cloudstack.config.ApiServiceConfiguration"
/>
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java b/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java
index f8f6d02..edf5a21 100644
--- a/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java
+++ b/api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java
@@ -16,9 +16,12 @@
 // under the License.
 package org.apache.cloudstack.config;
 
+import javax.ejb.Local;
+
 import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.Configurable;
 
+@Local(value = {ApiServiceConfiguration.class})
 public class ApiServiceConfiguration implements Configurable {
     public static final ConfigKey<String> ManagementHostIPAdr = new ConfigKey<String>("Advanced",
String.class, "host", "localhost", "The ip address of management server", true);
     public static final ConfigKey<String> ApiServletPath = new ConfigKey<String>("Advanced",
String.class, "api.servlet.endpoint", "http://localhost:8080/client/api?",
@@ -31,7 +34,7 @@ public class ApiServiceConfiguration implements Configurable {
 
     @Override
     public ConfigKey<?>[] getConfigKeys() {
-        return new ConfigKey<?>[] {ManagementHostIPAdr};
+        return new ConfigKey<?>[] {ManagementHostIPAdr, ApiServletPath};
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/framework/cluster/src/com/cloud/cluster/ClusterManager.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManager.java b/framework/cluster/src/com/cloud/cluster/ClusterManager.java
index f59e63c..ffdf366 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManager.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManager.java
@@ -26,7 +26,6 @@ public interface ClusterManager extends Manager {
         "Interval to check for the heart beat between management server nodes", false);
     final ConfigKey<Integer> HeartbeatThreshold = new ConfigKey<Integer>(Integer.class,
"cluster.heartbeat.threshold", "management-server", "150000",
         "Threshold before self-fence the management server", true);
-    final ConfigKey<String> ManagementHostIPAdr = new ConfigKey<String>("Advanced",
String.class, "host", "localhost", "The ip address of management server", true);
 
     void OnReceiveClusterServicePdu(ClusterServicePdu pdu);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
index ca0b031..622aa62 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
@@ -1099,7 +1099,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager,
C
 
     @Override
     public ConfigKey<?>[] getConfigKeys() {
-        return new ConfigKey<?>[] {HeartbeatInterval, HeartbeatThreshold, ManagementHostIPAdr};
+        return new ConfigKey<?>[] {HeartbeatInterval, HeartbeatThreshold};
     }
 
     private boolean pingManagementNode(ManagementServerHostVO mshost) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
index 50e9d89..1ed37ab 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
@@ -29,4 +29,6 @@ public interface ConfigDepot {
     Set<ConfigKey<?>> getConfigListByScope(String scope);
 
     <T> void set(ConfigKey<T> key, T value);
+
+    <T> void createOrUpdateConfigObject(String componentName, ConfigKey<T> key,
String value);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
index 929b299..c1ab6b8 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
@@ -27,15 +27,14 @@ import java.util.Set;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
-import org.apache.commons.lang.ObjectUtils;
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
 import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.ScopedConfigStorage;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.log4j.Logger;
 
 import com.cloud.utils.Pair;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -116,23 +115,8 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin
{
             }
             _allKeys.put(key.key(), new Pair<String, ConfigKey<?>>(configurable.getConfigComponentName(),
key));
 
-            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() || !ObjectUtils.equals(vo.getDescription(),
key.description()) ||
-                    !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) ||
-                    !ObjectUtils.equals(vo.getScope(), key.scope().toString())) {
-                    vo.setDynamic(key.isDynamic());
-                    vo.setDescription(key.description());
-                    vo.setDefaultValue(key.defaultValue());
-                    vo.setScope(key.scope().toString());
-                    vo.setUpdated(date);
-                    _configDao.persist(vo);
-                }
-            }
+            createOrupdateConfigObject(date, configurable.getConfigComponentName(), key,
null);
+
             if ((key.scope() != null) && (key.scope() != ConfigKey.Scope.Global))
{
                 Set<ConfigKey<?>> currentConfigs = _scopeLevelConfigsMap.get(key.scope());
                 currentConfigs.add(key);
@@ -142,6 +126,28 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin
{
         _configured.add(configurable);
     }
 
+    private void createOrupdateConfigObject(Date date, String componentName, ConfigKey<?>
key, String value) {
+        ConfigurationVO vo = _configDao.findById(key.key());
+        if (vo == null) {
+            vo = new ConfigurationVO(componentName, key);
+            vo.setUpdated(date);
+            if (value != null) {
+                vo.setValue(value);
+            }
+            _configDao.persist(vo);
+        } else {
+            if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(),
key.description()) || !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue())
+                    || !ObjectUtils.equals(vo.getScope(), key.scope().toString())) {
+                vo.setDynamic(key.isDynamic());
+                vo.setDescription(key.description());
+                vo.setDefaultValue(key.defaultValue());
+                vo.setScope(key.scope().toString());
+                vo.setUpdated(date);
+                _configDao.persist(vo);
+            }
+        }
+    }
+
     @Override
     public void populateConfiguration(Configurable configurable) {
         populateConfiguration(new Date(), configurable);
@@ -193,4 +199,10 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin
{
     public <T> void set(ConfigKey<T> key, T value) {
         _configDao.update(key.key(), value.toString());
     }
+
+    @Override
+    public <T> void createOrUpdateConfigObject(String componentName, ConfigKey<T>
key, String value) {
+        createOrupdateConfigObject(new Date(), componentName, key, value);
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0197006/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index b8786b8..cbf3728 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -152,6 +152,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
     @Inject
     protected ConfigurationManager _configMgr;
 
+
     public ConfigurationServerImpl() {
         setRunLevel(ComponentLifecycle.RUN_LEVEL_FRAMEWORK_BOOTSTRAP);
     }
@@ -247,7 +248,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                 }
 
                 if (needUpdateHostIp) {
-                    _configDao.update(ApiServiceConfiguration.ManagementHostIPAdr.key(),
ApiServiceConfiguration.ManagementHostIPAdr.category(), hostIpAdr);
+                    _configDepot.createOrUpdateConfigObject(ApiServiceConfiguration.class.getSimpleName(),
ApiServiceConfiguration.ManagementHostIPAdr, hostIpAdr);
                     s_logger.debug("ConfigurationServer saved \"" + hostIpAdr + "\" as host.");
                 }
             }


Mime
View raw message