Resource Metadata: added implementation for Remote Access VPN

This commit is contained in:
Alena Prokharchyk 2013-11-13 13:43:01 -08:00
parent 96b9ebafc0
commit 4a8e9f8b8d
9 changed files with 161 additions and 6 deletions

View File

@ -41,7 +41,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
NetworkACL (true, false),
StaticRoute (true, false),
VMSnapshot (true, false),
RemoteAccessVpn (true, false),
RemoteAccessVpn (true, true),
Zone (false, true),
ServiceOffering (false, true),
Storage(false, true);

View File

@ -322,7 +322,7 @@
<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="RemoteAccessVpnDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDaoImpl" />
<bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />

View File

@ -47,8 +47,8 @@ public class FirewallRuleDetailVO implements ResourceDetail{
public FirewallRuleDetailVO() {}
public FirewallRuleDetailVO(long networkId, String name, String value) {
this.resourceId = networkId;
public FirewallRuleDetailVO(long id, String name, String value) {
this.resourceId = id;
this.name = name;
this.value = value;
}

View File

@ -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="remote_access_vpn_details")
public class RemoteAccessVpnDetailVO implements ResourceDetail{
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name="id")
private long id;
@Column(name="remote_access_vpn_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 RemoteAccessVpnDetailVO() {}
public RemoteAccessVpnDetailVO(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;
}
}

View File

@ -47,8 +47,8 @@ public class UserIpAddressDetailVO implements ResourceDetail{
public UserIpAddressDetailVO() {}
public UserIpAddressDetailVO(long networkId, String name, String value) {
this.resourceId = networkId;
public UserIpAddressDetailVO(long id, String name, String value) {
this.resourceId = id;
this.name = name;
this.value = value;
}

View File

@ -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.RemoteAccessVpnDetailVO;
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
import com.cloud.utils.db.GenericDao;
public interface RemoteAccessVpnDetailsDao extends GenericDao<RemoteAccessVpnDetailVO, Long>, ResourceDetailsDao<RemoteAccessVpnDetailVO>{
}

View File

@ -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.RemoteAccessVpnDetailVO;
import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
import org.springframework.stereotype.Component;
@Component
@Local (value={RemoteAccessVpnDetailsDao.class})
public class RemoteAccessVpnDetailsDaoImpl extends ResourceDetailsDaoBase<RemoteAccessVpnDetailVO> implements RemoteAccessVpnDetailsDao {
@Override
public void addDetail(long resourceId, String key, String value) {
super.addDetail(new RemoteAccessVpnDetailVO(resourceId, key, value));
}
}

View File

@ -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.RemoteAccessVpnDetailsDao;
import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
import org.apache.log4j.Logger;
@ -78,6 +79,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
FirewallRuleDetailsDao _firewallRuleDetailsDao;
@Inject
UserIpAddressDetailsDao _userIpAddressDetailsDao;
@Inject
RemoteAccessVpnDetailsDao _vpnDetailsDao;
private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> _daoMap=
new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
@ -97,6 +100,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
_daoMap.put(ResourceObjectType.PublicIpAddress, _userIpAddressDetailsDao);
_daoMap.put(ResourceObjectType.PortForwardingRule, _firewallRuleDetailsDao);
_daoMap.put(ResourceObjectType.LoadBalancer, _firewallRuleDetailsDao);
_daoMap.put(ResourceObjectType.RemoteAccessVpn, _vpnDetailsDao);
return true;
}

View File

@ -629,3 +629,13 @@ CREATE TABLE `cloud`.`user_ip_address_details` (
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;
CREATE TABLE `cloud`.`remote_access_vpn_details` (
`id` bigint unsigned NOT NULL auto_increment,
`remote_access_vpn_id` bigint unsigned NOT NULL COMMENT 'Remote access vpn 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_remote_access_vpn_details__remote_access_vpn_id` FOREIGN KEY `fk_remote_access_vpn_details__remote_access_vpn_id`(`remote_access_vpn_id`) REFERENCES `remote_access_vpn`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;