cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/master to 8bd1eaa
Date Fri, 08 Nov 2013 18:48:14 GMT
Updated Branches:
  refs/heads/master 31b439eab -> 8bd1eaa21


ResourceMetaData: added support for userIpAddress (publicIp) metadata


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

Branch: refs/heads/master
Commit: 8bd1eaa210f67f1347e7ecc4406e48d29783ca3d
Parents: 31b439e
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Fri Nov 8 10:37:45 2013 -0800
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Nov 8 10:48:43 2013 -0800

----------------------------------------------------------------------
 api/src/com/cloud/server/ResourceTag.java       |  2 +-
 .../spring-engine-schema-core-daos-context.xml  |  2 +
 .../resourcedetail/FirewallRuleDetailVO.java    | 78 +++++++++----------
 .../resourcedetail/UserIpAddressDetailVO.java   | 80 ++++++++++++++++++++
 .../dao/UserIpAddressDetailsDao.java            | 26 +++++++
 .../dao/UserIpAddressDetailsDaoImpl.java        | 35 +++++++++
 .../metadata/ResourceMetaDataManagerImpl.java   |  6 +-
 setup/db/db/schema-421to430.sql                 | 10 +++
 8 files changed, 198 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/api/src/com/cloud/server/ResourceTag.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index ab74d26..47e00be 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -35,7 +35,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
         PortForwardingRule (true, false),
         FirewallRule (true, true),
         SecurityGroup (true, false),
-        PublicIpAddress (true, false),
+        PublicIpAddress (true, true),
         Project (true, false),
         Vpc (true, false),
         NetworkACL (true, false),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
----------------------------------------------------------------------
diff --git a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
index c71190b..0a5ae50 100644
--- a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
+++ b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml
@@ -321,6 +321,8 @@
   <bean id="AffinityGroupVMMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDaoImpl"
/>
   <bean id="AffinityGroupDomainMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupDomainMapDaoImpl"
/>
   <bean id="FirewallRuleDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDaoImpl"
/>
+  <bean id="UserIpAddressDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDaoImpl"
/>
+
   
   <bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker"
/>
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
b/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
index 88d2b00..a2ec6ff 100644
--- a/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/FirewallRuleDetailVO.java
@@ -28,53 +28,53 @@ import org.apache.cloudstack.api.ResourceDetail;
 @Entity
 @Table(name="firewall_rule_details")
 public class FirewallRuleDetailVO implements ResourceDetail{
-        @Id
-        @GeneratedValue(strategy= GenerationType.IDENTITY)
-        @Column(name="id")
-        private long id;
+    @Id
+    @GeneratedValue(strategy= GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
 
-        @Column(name="firewall_rule_id")
-        private long resourceId;
+    @Column(name="firewall_rule_id")
+    private long resourceId;
 
-        @Column(name="name")
-        private String name;
+    @Column(name="name")
+    private String name;
 
-        @Column(name="value", length=1024)
-        private String value;
-        
-        @Column(name="display")
-        private boolean display;
+    @Column(name="value", length=1024)
+    private String value;
+    
+    @Column(name="display")
+    private boolean display;
 
-        public FirewallRuleDetailVO() {}
+    public FirewallRuleDetailVO() {}
 
-        public FirewallRuleDetailVO(long networkId, String name, String value) {
-            this.resourceId = networkId;
-            this.name = name;
-            this.value = value;
-        }
+    public FirewallRuleDetailVO(long networkId, String name, String value) {
+        this.resourceId = networkId;
+        this.name = name;
+        this.value = value;
+    }
 
-        @Override
-        public long getId() {
-            return id;
-        }
+    @Override
+    public long getId() {
+        return id;
+    }
 
-        @Override
-        public String getName() {
-            return name;
-        }
+    @Override
+    public String getName() {
+        return name;
+    }
 
-        @Override
-        public String getValue() {
-            return value;
-        }
+    @Override
+    public String getValue() {
+        return value;
+    }
 
-        @Override
-        public long getResourceId() {
-            return resourceId;
-        }
+    @Override
+    public long getResourceId() {
+        return resourceId;
+    }
 
-        @Override
-        public boolean isDisplay() {
-            return display;
-        }
+    @Override
+    public boolean isDisplay() {
+        return display;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
new file mode 100644
index 0000000..56a47c2
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/UserIpAddressDetailVO.java
@@ -0,0 +1,80 @@
+// 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.resourcedetail;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.ResourceDetail;
+
+@Entity
+@Table(name="user_ip_address_details")
+public class UserIpAddressDetailVO implements ResourceDetail{
+    @Id
+    @GeneratedValue(strategy= GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="user_ip_address_id")
+    private long resourceId;
+
+    @Column(name="name")
+    private String name;
+
+    @Column(name="value", length=1024)
+    private String value;
+    
+    @Column(name="display")
+    private boolean display;
+
+    public UserIpAddressDetailVO() {}
+
+    public UserIpAddressDetailVO(long networkId, String name, String value) {
+        this.resourceId = networkId;
+        this.name = name;
+        this.value = value;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getValue() {
+        return value;
+    }
+
+    @Override
+    public long getResourceId() {
+        return resourceId;
+    }
+
+    @Override
+    public boolean isDisplay() {
+        return display;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDao.java
b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDao.java
new file mode 100644
index 0000000..856f508
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDao.java
@@ -0,0 +1,26 @@
+// 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.resourcedetail.dao;
+
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
+import org.apache.cloudstack.resourcedetail.UserIpAddressDetailVO;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface UserIpAddressDetailsDao extends GenericDao<UserIpAddressDetailVO, Long>,
ResourceDetailsDao<UserIpAddressDetailVO>{
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java
b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java
new file mode 100644
index 0000000..c1cb137
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/UserIpAddressDetailsDaoImpl.java
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.resourcedetail.dao;
+
+import javax.ejb.Local;
+
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
+import org.apache.cloudstack.resourcedetail.UserIpAddressDetailVO;
+import org.springframework.stereotype.Component;
+
+
+@Component
+@Local (value={UserIpAddressDetailsDao.class})
+public class UserIpAddressDetailsDaoImpl extends ResourceDetailsDaoBase<UserIpAddressDetailVO>
implements UserIpAddressDetailsDao {
+
+    @Override
+    public void addDetail(long resourceId, String key, String value) {
+        super.addDetail(new UserIpAddressDetailVO(resourceId, key, value));
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
index 5f7ad4b..4ebc43e 100644
--- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
+++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java
@@ -27,6 +27,7 @@ import javax.naming.ConfigurationException;
 import org.apache.cloudstack.api.ResourceDetail;
 import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
 import org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDao;
+import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -75,6 +76,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements
Resource
     StoragePoolDetailsDao _storageDetailsDao;
     @Inject
     FirewallRuleDetailsDao _firewallRuleDetailsDao;
+    @Inject
+    UserIpAddressDetailsDao _userIpAddressDetailsDao;
     
     private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>
_daoMap= 
             new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
@@ -91,7 +94,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements
Resource
         _daoMap.put(ResourceObjectType.Zone, _dcDetailsDao);
         _daoMap.put(ResourceObjectType.Storage, _storageDetailsDao);
         _daoMap.put(ResourceObjectType.FirewallRule, _firewallRuleDetailsDao);
-        
+        _daoMap.put(ResourceObjectType.PublicIpAddress, _userIpAddressDetailsDao);
+
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bd1eaa2/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index dbfab4a..8b0d136 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -619,3 +619,13 @@ CREATE TABLE `cloud`.`usage_event_details` (
   PRIMARY KEY (`id`),
   CONSTRAINT `fk_usage_event_details__usage_event_id` FOREIGN KEY `fk_usage_event_details__usage_event_id`(`usage_event_id`)
REFERENCES `usage_event`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`user_ip_address_details` (
+  `id` bigint unsigned NOT NULL auto_increment,
+  `user_ip_address_id` bigint unsigned NOT NULL COMMENT 'User ip address id',
+  `name` varchar(255) NOT NULL,
+  `value` varchar(1024) NOT NULL,
+  `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed
to the end user',
+  PRIMARY KEY (`id`),
+  CONSTRAINT `fk_user_ip_address_details__user_ip_address_id` FOREIGN KEY `fk_user_ip_address_details__user_ip_address_id`(`user_ip_address_id`)
REFERENCES `user_ip_address`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Mime
View raw message