diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java index 275510e1a1a..d91bb7d519a 100644 --- a/api/src/com/cloud/server/ResourceTag.java +++ b/api/src/com/cloud/server/ResourceTag.java @@ -53,7 +53,10 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit User(true, true), DiskOffering(false, true), AutoScaleVmProfile(false, true), - AutoScaleVmGroup(false, true); + AutoScaleVmGroup(false, true), + LBStickinessPolicy(false, true), + LBHealthCheckPolicy(false, true); + ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) { this.resourceTagsSupport = resourceTagsSupport; 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 f5050e229b0..2ef0d206a63 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 @@ -338,5 +338,8 @@ + + + diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/LBHealthCheckPolicyDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBHealthCheckPolicyDetailVO.java new file mode 100644 index 00000000000..52b30ff18b4 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBHealthCheckPolicyDetailVO.java @@ -0,0 +1,78 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +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 = "load_balancer_healthcheck_policy_details") +public class LBHealthCheckPolicyDetailVO implements ResourceDetail{ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "lb_policy_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value", length = 1024) + private String value; + + @Column(name = "display") + private boolean display = true; + + public LBHealthCheckPolicyDetailVO() { + } + + public LBHealthCheckPolicyDetailVO(long id, String name, String value, boolean display) { + this.resourceId = id; + this.name = name; + this.value = value; + this.display = display; + } + + @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; + } +} diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/LBStickinessPolicyDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBStickinessPolicyDetailVO.java new file mode 100644 index 00000000000..caa2d90000f --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBStickinessPolicyDetailVO.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 = "load_balancer_stickiness_policy_details") +public class LBStickinessPolicyDetailVO implements ResourceDetail { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "lb_policy_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value", length = 1024) + private String value; + + @Column(name = "display") + private boolean display = true; + + public LBStickinessPolicyDetailVO() { + } + + public LBStickinessPolicyDetailVO(long id, String name, String value, boolean display) { + this.resourceId = id; + this.name = name; + this.value = value; + this.display = display; + } + + @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; + } +} diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDao.java new file mode 100644 index 00000000000..9f8fcddd1d3 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDao.java @@ -0,0 +1,22 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import org.apache.cloudstack.resourcedetail.LBHealthCheckPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; + +import com.cloud.utils.db.GenericDao; + +public interface LBHealthCheckPolicyDetailsDao extends GenericDao, ResourceDetailsDao{ + +} diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDaoImpl.java new file mode 100644 index 00000000000..ab2e07f50d1 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDaoImpl.java @@ -0,0 +1,29 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import javax.ejb.Local; + +import org.apache.cloudstack.resourcedetail.LBHealthCheckPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.springframework.stereotype.Component; + +@Component +@Local(value = {LBHealthCheckPolicyDetailsDao.class}) +public class LBHealthCheckPolicyDetailsDaoImpl extends ResourceDetailsDaoBase implements LBHealthCheckPolicyDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new LBHealthCheckPolicyDetailVO(resourceId, key, value, display)); + } +} \ No newline at end of file diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDao.java new file mode 100644 index 00000000000..512debc38cf --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDao.java @@ -0,0 +1,22 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import org.apache.cloudstack.resourcedetail.LBStickinessPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; + +import com.cloud.utils.db.GenericDao; + +public interface LBStickinessPolicyDetailsDao extends GenericDao, ResourceDetailsDao{ + +} diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDaoImpl.java new file mode 100644 index 00000000000..a9afa2280c2 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDaoImpl.java @@ -0,0 +1,29 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import javax.ejb.Local; + +import org.apache.cloudstack.resourcedetail.LBStickinessPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.springframework.stereotype.Component; + +@Component +@Local(value = {LBStickinessPolicyDetailsDao.class}) +public class LBStickinessPolicyDetailsDaoImpl extends ResourceDetailsDaoBase implements LBStickinessPolicyDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new LBStickinessPolicyDetailVO(resourceId, key, value, display)); + } +} \ No newline at end of file diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java index d91da921ebc..f7b092c5bd4 100644 --- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java +++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java @@ -40,7 +40,10 @@ import org.apache.cloudstack.resourcedetail.dao.UserDetailsDao; 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.resourcedetail.dao.LBStickinessPolicyDetailsDao; +import org.apache.cloudstack.resourcedetail.dao.LBHealthCheckPolicyDetailsDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; + import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -113,6 +116,10 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource AutoScaleVmProfileDetailsDao _autoScaleVmProfileDetailsDao; @Inject AutoScaleVmGroupDetailsDao _autoScaleVmGroupDetailsDao; + @Inject + LBStickinessPolicyDetailsDao _stickinessPolicyDao; + @Inject + LBHealthCheckPolicyDetailsDao _healthcheckPolicyDao; private static Map> s_daoMap = new HashMap>(); @@ -142,6 +149,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource s_daoMap.put(ResourceObjectType.User, _userDetailsDao); s_daoMap.put(ResourceObjectType.AutoScaleVmProfile, _autoScaleVmProfileDetailsDao); s_daoMap.put(ResourceObjectType.AutoScaleVmGroup, _autoScaleVmGroupDetailsDao); + s_daoMap.put(ResourceObjectType.LBStickinessPolicy, _stickinessPolicyDao); + s_daoMap.put(ResourceObjectType.LBHealthCheckPolicy, _healthcheckPolicyDao); return true; } diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java index 71722a99ad3..cac12c628d6 100644 --- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java +++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java @@ -25,12 +25,11 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.log4j.Logger; import com.cloud.api.query.dao.ResourceTagJoinDao; import com.cloud.dc.DataCenterVO; @@ -40,9 +39,11 @@ import com.cloud.event.ActionEvent; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; +import com.cloud.network.LBHealthCheckPolicyVO; import com.cloud.network.as.AutoScaleVmGroupVO; import com.cloud.network.as.AutoScaleVmProfileVO; import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.dao.LBStickinessPolicyVO; import com.cloud.network.dao.LoadBalancerVO; import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.RemoteAccessVpnVO; @@ -120,6 +121,9 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso s_typeMap.put(ResourceObjectType.DiskOffering, DiskOfferingVO.class); s_typeMap.put(ResourceObjectType.AutoScaleVmProfile, AutoScaleVmProfileVO.class); s_typeMap.put(ResourceObjectType.AutoScaleVmGroup, AutoScaleVmGroupVO.class); + s_typeMap.put(ResourceObjectType.LBStickinessPolicy, LBStickinessPolicyVO.class); + s_typeMap.put(ResourceObjectType.LBHealthCheckPolicy, LBHealthCheckPolicyVO.class); + } @Inject