You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2013/11/27 02:21:52 UTC

git commit: updated refs/heads/4.3 to c9b0a8b

Updated Branches:
  refs/heads/4.3 069293434 -> c9b0a8b1f


Resource metadata support for NetworkACLList


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

Branch: refs/heads/4.3
Commit: c9b0a8b1f45b153dc860dc5d40c3295a8e2f42ce
Parents: 0692934
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Nov 26 14:55:04 2013 -0800
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Nov 26 17:22:32 2013 -0800

----------------------------------------------------------------------
 api/src/com/cloud/server/ResourceTag.java       |  3 +-
 .../spring-engine-schema-core-daos-context.xml  |  2 +
 .../resourcedetail/NetworkACLListDetailVO.java  | 82 ++++++++++++++++++++
 .../dao/NetworkACLListDetailsDao.java           | 26 +++++++
 .../dao/NetworkACLListDetailsDaoImpl.java       | 33 ++++++++
 .../metadata/ResourceMetaDataManagerImpl.java   |  4 +
 .../cloud/tags/TaggedResourceManagerImpl.java   |  5 +-
 setup/db/db/schema-421to430.sql                 | 10 +++
 8 files changed, 163 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9b0a8b1/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 a74b4b9..d926871 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -46,7 +46,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
         Zone(false, true),
         ServiceOffering(false, true),
         Storage(false, true),
-        PrivateGateway(false, true);
+        PrivateGateway(false, true),
+        NetworkACLList(false, true);
 
         ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
             this.resourceTagsSupport = resourceTagsSupport;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9b0a8b1/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 4a31b91..d12e5cb 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
@@ -325,6 +325,8 @@
   <bean id="RemoteAccessVpnDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDaoImpl" />
   <bean id="VpcDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.VpcDetailsDaoImpl" />
   <bean id="VpcGatewayDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.VpcGatewayDetailsDaoImpl" />
+  <bean id="NetworkACLListDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.NetworkACLListDetailsDaoImpl" />
+
   <bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />
 
 </beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9b0a8b1/engine/schema/src/org/apache/cloudstack/resourcedetail/NetworkACLListDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/NetworkACLListDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/NetworkACLListDetailVO.java
new file mode 100644
index 0000000..71cf563
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/NetworkACLListDetailVO.java
@@ -0,0 +1,82 @@
+// 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 = "network_acl_details")
+public class NetworkACLListDetailVO implements ResourceDetail {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "network_acl_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 NetworkACLListDetailVO() {
+    }
+
+    public NetworkACLListDetailVO(long id, String name, String value) {
+        this.resourceId = id;
+        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/c9b0a8b1/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDao.java
new file mode 100644
index 0000000..1c85245
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDao.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.NetworkACLListDetailVO;
+import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkACLListDetailsDao extends GenericDao<NetworkACLListDetailVO, Long>, ResourceDetailsDao<NetworkACLListDetailVO> {
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9b0a8b1/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java
new file mode 100644
index 0000000..0b7037f
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/NetworkACLListDetailsDaoImpl.java
@@ -0,0 +1,33 @@
+// 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.NetworkACLListDetailVO;
+import org.springframework.stereotype.Component;
+
+@Component
+@Local(value = { NetworkACLListDetailsDao.class })
+public class NetworkACLListDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkACLListDetailVO> implements NetworkACLListDetailsDao {
+
+    @Override
+    public void addDetail(long resourceId, String key, String value) {
+        super.addDetail(new NetworkACLListDetailVO(resourceId, key, value));
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9b0a8b1/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 53c1ad3..e7f9d74 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.NetworkACLListDetailsDao;
 import org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDao;
 import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
 import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
@@ -87,6 +88,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
     VpcDetailsDao _vpcDetailsDao;
     @Inject
     VpcGatewayDetailsDao _vpcGatewayDetailsDao;
+    @Inject
+    NetworkACLListDetailsDao _networkACLListDetailsDao;
 
     private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> _daoMap =
             new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
@@ -108,6 +111,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
         _daoMap.put(ResourceObjectType.RemoteAccessVpn, _vpnDetailsDao);
         _daoMap.put(ResourceObjectType.Vpc, _vpcDetailsDao);
         _daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDetailsDao);
+        _daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDetailsDao);
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9b0a8b1/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
index 273438c..612b7b5 100644
--- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
+++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
@@ -45,6 +45,7 @@ import com.cloud.network.dao.RemoteAccessVpnDao;
 import com.cloud.network.rules.dao.PortForwardingRulesDao;
 import com.cloud.network.security.dao.SecurityGroupDao;
 import com.cloud.network.vpc.NetworkACLItemDao;
+import com.cloud.network.vpc.dao.NetworkACLDao;
 import com.cloud.network.vpc.dao.StaticRouteDao;
 import com.cloud.network.vpc.dao.VpcDao;
 import com.cloud.network.vpc.dao.VpcGatewayDao;
@@ -137,6 +138,8 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
     PrimaryDataStoreDao _storagePoolDao;
     @Inject
     VpcGatewayDao _vpcGatewayDao;
+    @Inject
+    NetworkACLDao _networkACLListDao;
 
 
     @Override
@@ -163,7 +166,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
         _daoMap.put(ResourceObjectType.ServiceOffering, _serviceOffDao);
         _daoMap.put(ResourceObjectType.Storage, _storagePoolDao);
         _daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDao);
-
+        _daoMap.put(ResourceObjectType.NetworkACLList, _networkACLListDao);
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9b0a8b1/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index cf2cff4..dad9a6b 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -779,3 +779,13 @@ CREATE TABLE `cloud`.`vpc_gateway_details` (
   PRIMARY KEY (`id`),
   CONSTRAINT `fk_vpc_gateway_details__vpc_gateway_id` FOREIGN KEY `fk_vpc_gateway_details__vpc_gateway_id`(`vpc_gateway_id`) REFERENCES `vpc_gateways`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`network_acl_details` (
+  `id` bigint unsigned NOT NULL auto_increment,
+  `network_acl_id` bigint unsigned NOT NULL COMMENT 'VPC gateway 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_network_acl_details__network_acl_id` FOREIGN KEY `fk_network_acl_details__network_acl_id`(`network_acl_id`) REFERENCES `network_acl`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;