Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E4B9610792 for ; Tue, 26 Nov 2013 20:47:40 +0000 (UTC) Received: (qmail 77680 invoked by uid 500); 26 Nov 2013 20:47:40 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 77635 invoked by uid 500); 26 Nov 2013 20:47:39 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 77557 invoked by uid 99); 26 Nov 2013 20:47:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Nov 2013 20:47:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9C8D1918FA4; Tue, 26 Nov 2013 20:47:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alena1108@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 5d974a2 Date: Tue, 26 Nov 2013 20:47:39 +0000 (UTC) Updated Branches: refs/heads/master 6bea532ef -> 5d974a234 Resource metadata support for VPC Private Gateway Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5d974a23 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5d974a23 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5d974a23 Branch: refs/heads/master Commit: 5d974a234c82487206f4d12baa9cff510e3a3260 Parents: 6bea532 Author: Alena Prokharchyk Authored: Tue Nov 26 11:28:20 2013 -0800 Committer: Alena Prokharchyk Committed: Tue Nov 26 12:48:15 2013 -0800 ---------------------------------------------------------------------- api/src/com/cloud/server/ResourceTag.java | 3 +- .../spring-engine-schema-core-daos-context.xml | 1 + .../resourcedetail/VpcGatewayDetailVO.java | 81 ++++++++++++++++++++ .../dao/VpcGatewayDetailsDao.java | 27 +++++++ .../dao/VpcGatewayDetailsDaoImpl.java | 33 ++++++++ .../metadata/ResourceMetaDataManagerImpl.java | 9 ++- .../cloud/tags/TaggedResourceManagerImpl.java | 9 ++- setup/db/db/schema-421to430.sql | 11 +++ 8 files changed, 167 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d974a23/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 8a91164..1881b9f 100644 --- a/api/src/com/cloud/server/ResourceTag.java +++ b/api/src/com/cloud/server/ResourceTag.java @@ -44,7 +44,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit RemoteAccessVpn(true, true), Zone(false, true), ServiceOffering(false, true), - Storage(false, true); + Storage(false, true), + PrivateGateway(false, true); ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) { this.resourceTagsSupport = resourceTagsSupport; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d974a23/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 23db19d..4a31b91 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 @@ -324,6 +324,7 @@ + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d974a23/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java new file mode 100644 index 0000000..b78bfa8 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/VpcGatewayDetailVO.java @@ -0,0 +1,81 @@ +// 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 = "vpc_gateway_details") +public class VpcGatewayDetailVO implements ResourceDetail { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "vpc_gateway_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 VpcGatewayDetailVO() { + } + + public VpcGatewayDetailVO(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/5d974a23/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDao.java new file mode 100644 index 0000000..4f16919 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDao.java @@ -0,0 +1,27 @@ +// 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.VpcGatewayDetailVO; + +import com.cloud.utils.db.GenericDao; + +public interface VpcGatewayDetailsDao extends GenericDao, ResourceDetailsDao { + +} + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d974a23/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.java new file mode 100644 index 0000000..2b4c563 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/VpcGatewayDetailsDaoImpl.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.VpcGatewayDetailVO; +import org.springframework.stereotype.Component; + +@Component +@Local(value = { VpcGatewayDetailsDao.class }) +public class VpcGatewayDetailsDaoImpl extends ResourceDetailsDaoBase implements VpcGatewayDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value) { + super.addDetail(new VpcGatewayDetailVO(resourceId, key, value)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d974a23/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 583401a..587f4fe 100644 --- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java +++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java @@ -24,16 +24,16 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - 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.RemoteAccessVpnDetailsDao; import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao; import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao; +import org.apache.cloudstack.resourcedetail.dao.VpcGatewayDetailsDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.dc.dao.DataCenterDetailsDao; import com.cloud.event.ActionEvent; @@ -84,6 +84,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource RemoteAccessVpnDetailsDao _vpnDetailsDao; @Inject VpcDetailsDao _vpcDetailsDao; + @Inject + VpcGatewayDetailsDao _vpcGatewayDetailsDao; private static Map> _daoMap = new HashMap>(); @@ -104,6 +106,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource _daoMap.put(ResourceObjectType.LoadBalancer, _firewallRuleDetailsDao); _daoMap.put(ResourceObjectType.RemoteAccessVpn, _vpnDetailsDao); _daoMap.put(ResourceObjectType.Vpc, _vpcDetailsDao); + _daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDetailsDao); return true; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d974a23/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 f6529b2..d78105b 100644 --- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java +++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java @@ -25,11 +25,10 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.api.query.dao.ResourceTagJoinDao; import com.cloud.dc.dao.DataCenterDao; @@ -48,6 +47,7 @@ import com.cloud.network.security.dao.SecurityGroupDao; import com.cloud.network.vpc.NetworkACLItemDao; import com.cloud.network.vpc.dao.StaticRouteDao; import com.cloud.network.vpc.dao.VpcDao; +import com.cloud.network.vpc.dao.VpcGatewayDao; import com.cloud.projects.dao.ProjectDao; import com.cloud.server.ResourceTag; import com.cloud.server.ResourceTag.ResourceObjectType; @@ -133,6 +133,8 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso ServiceOfferingDao _serviceOffDao; @Inject PrimaryDataStoreDao _storagePoolDao; + @Inject + VpcGatewayDao _vpcGatewayDao; @Override public boolean configure(String name, Map params) throws ConfigurationException { @@ -157,6 +159,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso _daoMap.put(ResourceObjectType.Zone, _dataCenterDao); _daoMap.put(ResourceObjectType.ServiceOffering, _serviceOffDao); _daoMap.put(ResourceObjectType.Storage, _storagePoolDao); + _daoMap.put(ResourceObjectType.PrivateGateway, _vpcGatewayDao); return true; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d974a23/setup/db/db/schema-421to430.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql index 521ac16..cf2cff4 100644 --- a/setup/db/db/schema-421to430.sql +++ b/setup/db/db/schema-421to430.sql @@ -768,3 +768,14 @@ CREATE TABLE `cloud`.`vpc_details` ( PRIMARY KEY (`id`), CONSTRAINT `fk_vpc_details__vpc_id` FOREIGN KEY `fk_vpc_details__vpc_id`(`vpc_id`) REFERENCES `vpc`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `cloud`.`vpc_gateway_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `vpc_gateway_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_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;